Jump to content

Fonksiyon Içerisinde Do Until Döngüsü


radyofon
 Share

Recommended Posts

Do Until döngüsü kendi başına çalışabiliyor fakat bir fonksiyon içerisine atadığım zaman çalışmıyor.
[code]

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>

Global $ScriptDir = @ScriptDir
Global $TxtFile = $ScriptDir & "IP.txt"

If FileExists($TxtFile) = 0 Then
FileWrite($TxtFile, "")
EndIf

;Global $file = FileOpen("IP.txt", 1)
;If $file = -1 Then
; MsgBox(0, "Error", "Unable to open file.")
; Exit
;EndIf

$MainGUI = GUICreate("Form1", 220, 447, 192, 124)
$ipcreate = GUICtrlCreateButton("IP text oluştur", 10, 64, 150, 30, $WS_GROUP)
GUICtrlSetOnEvent(-1, "CreateText")

Func CreateText()
$line = 1
Do
FileWriteLine($TxtFile, $line)
$line = $line + 1
Until $line = 255
EndFunc

;$IPAddress1 = _GUICtrlIpAddress_Create($MainGUI, 10, 136, 150, 30)
;_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd[/code]
Link to comment
Share on other sites

[codebox]#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>

Global $ScriptDir = @ScriptDir
if StringRight($ScriptDir,1) <> "\" Then $ScriptDir &= "\"
Global $TxtFile = $ScriptDir & "IP.txt"

If FileExists($TxtFile) = 0 Then FileWrite($TxtFile, "")
;Global $file = FileOpen("IP.txt", 1)
;If $file = -1 Then
; MsgBox(0, "Error", "Unable to open file.")
; Exit
;EndIf
$MainGUI = GUICreate("Form1", 220, 447, 192, 124)
$ipcreate = GUICtrlCreateButton("IP text oluştur", 10, 64, 150, 30, $WS_GROUP)
;$IPAddress1 = _GUICtrlIpAddress_Create($MainGUI, 10, 136, 150, 30)
;_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
GUISetState()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ipcreate
CreateText()
EndSwitch
WEnd

Func CreateText()
$line = 1
Do
FileWriteLine($TxtFile, $line)
$line = $line + 1
Until $line = 255
EndFunc
[/codebox]

Guictrlsetonevent ı kullanman için guioneventmode u aktifleştirmen gerekli. şu anda ben aktifleştirmedim.

Link to comment
Share on other sites

Teşekkürler üstadım. İlk sorunu sayende aştık. Bir IP bloğu oluşturacağım ve bu blok içerisinden (txt dosyası) ip' lerin bilgisayarlara dağıtımının yapılmasını planlıyorum. Tabii ki birinci satırdaki ip kullanıldıktan sonra silinecek ki ikinci bilgisayarda aynı ip ve diğerlerinde tekrar verilmesin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...