radyofon Posted March 10, 2012 Share Posted March 10, 2012 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] Quote Link to comment Share on other sites More sharing options...
blackman12 Posted March 10, 2012 Share Posted March 10, 2012 [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. Quote Link to comment Share on other sites More sharing options...
radyofon Posted March 10, 2012 Author Share Posted March 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.