MrChris Posted August 11, 2006 Share Posted August 11, 2006 I am trying to run a Run function but not until I specific ControlID 1009 has text that is = to a $var. Am am a little confused on how to do it. Au3Info.exe shows the ControlID as 1009 but the Text of that controlID is dynamic and is bound to change. Early in the script I set that $var to what ever that text should be but want to run a funtion but not until the ControlID in question has text that is equal to $var? Make Sense? Regards, MrChris Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 11, 2006 Share Posted August 11, 2006 (edited) I am trying to run a Run function but not until I specific ControlID 1009 has text that is = to a $var. Am am a little confused on how to do it. Au3Info.exe shows the ControlID as 1009 but the Text of that controlID is dynamic and is bound to change. Early in the script I set that $var to what ever that text should be but want to run a funtion but not until the ControlID in question has text that is equal to $var? Make Sense? Regards, MrChris While 1 If GuiCtrlRead(1009) = $var Then _MyFunction() ExitLoop EndIf Sleep(100) WendoÝ÷ ØóÒi¥¢u«Ré7l)Þjwb·lmëmz»"Ç¢·lr¢êèÂp.¶B2¢æ«zj'Ú+x«p¢é]©¶¦jëh×6While ControlGetText("Window Title", "Optional Window Text", 1009) <> $var Sleep(100) Wend _MyFunction()oÝ÷ ØêÚºÚ"µÍÚ[HÝÝ[Ò[ÝÛÛÛÙ]^ ][ÝÕÚ[ÝÈ]I][ÝË ][ÝÓÜ[Û[Ú[ÝÈ^ ][ÝËLJK ÌÍÝBÛY L BÙ[Ó^Q[Ý[Û :-) Edited August 11, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 11, 2006 Moderators Share Posted August 11, 2006 (edited) If ControlGetHandle('Window', '', 1099) <> '' _ And ControlGetText('Window', '', 1099) = $var Then MsgBox(64, 'Info', 'Control Exists and Text is correct') Edited August 11, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MrChris Posted August 11, 2006 Author Share Posted August 11, 2006 (edited) I am trying to repackage Hamachi VPN. So far I am able to get it to run as I want it to but. I am stuck as runnging a hamachi config after the Hamachi app is opened and ControlID 1009 is set to $var. Hamachi will not Join a Network room until the Client is connected to the Hamachi Server and displays a valid $var So far this is what I have. expandcollapse popup#NoTrayIcon $hamachi_path = @ProgramFilesDir & '\Hamachi_temp' $config = @ProgramFilesDir & '\Hamachi_temp' & '\test.hamachi' $hamachi_exe = @ProgramFilesDir & '\Hamachi_Temp' & '\hamachi.exe' Global $hamachi Global $hamachi_exe Global $config Global $hamachi_path Global $sitename #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Mandatory, Height=125 If Not IsDeclared("sitename") Then Dim $sitename $sitename = InputBox("Connection Name!","Please provide a name for this connection!",""," M","-1","125","-1","-1") Select Case @Error = 0 ;OK - The string returned is valid Case @Error = 1 ;The Cancel button was pushed Case @Error = 3 ;The InputBox failed to open EndSelect #EndRegion --- CodeWizard generated code End --- ; Sets Environment Var to Users ApplicationData Directory $appdata_hamachi = @AppDataDir & '\Hamachi' $hamachi = @ProgramFilesDir & '\Hamachi_Temp' DirCreate ( $appdata_hamachi ) DirCreate ( $hamachi ) DirCreate ( $hamachi & '\Networks' ) DirCreate ( $hamachi & '\Chat Logs' ) DirCreate ( $hamachi & '\RSA Keys' ) ; Registers File Types RegWrite("HKEY_CLASSES_ROOT\Hamachi\shell\open\command","","REG_SZ",'"C:\Program Files\Hamachi_temp\hamachi.exe" "%L"') RegWrite("HKEY_CLASSES_ROOT\Hamachi\shell\open\command","Content Type","REG_SZ",'application/hamachi') RegWrite("HKEY_CLASSES_ROOT\.hamachi","","REG_SZ",'Hamachi') ; Files to compile and extract to C:\Program Files\Hamachi FileInstall ( "hamachi.exe", $hamachi & '\hamachi.exe',1 ) FileInstall ( "hamachi.inf", $hamachi & '\hamachi.inf',1 ) FileInstall ( "hamachi.key", $hamachi & '\hamachi.key',1 ) FileInstall ( "hamachi.sys", $hamachi & '\hamachi.sys',1 ) FileInstall ( "hamachi.lng", $hamachi & '\hamachi.lng',1 ) FileInstall ( "hamachi.ttf", $hamachi & '\hamachi.ttf',1 ) FileInstall ( "license.txt", $hamachi & '\license.txt',1 ) FileInstall ( "tapinstall.exe", $hamachi & '\tapinstall.exe',1 ) FileInstall ( "nicmgr.exe", $hamachi & '\nicmgr.exe',1 ) FileInstall ( "test.hamachi", $hamachi & '\test.hamachi',1 ) ; Files to compile and extract to C:\Documents and Settings\%username%\Hamachi ;FileInstall ( "client.id", $appdata_hamachi & '\client.id',1 ) ;FileInstall ( "client.pri", $appdata_hamachi & '\client.pri',1 ) ;FileInstall ( "client.pub", $appdata_hamachi & '\client.pub',1 ) FileInstall ( "hamachi.ini", $appdata_hamachi & '\hamachi.ini',1 ) FileInstall ( "peers.ini", $appdata_hamachi & '\peers.ini',1 ) FileInstall ( "hamachi-override.ini", $appdata_hamachi & '\hamachi-override.ini',1) $hamachi_override_config = FileOpen($appdata_hamachi & '\hamachi-override.ini',1) FileWriteLine($hamachi_override_config,"Nickname "&$sitename) FileWriteLine($hamachi_override_config,"OnlineNet Test") FileClose($hamachi_override_config) $config = FileOpen($hamachi & '\test.hamachi',1) FileWriteLine($config,"Type: command/join") FileWriteLine($config,"Name: Test") FileWriteLine($config,"Pass: 123456") FileClose($config) RunWait ( $hamachi & '\tapinstall.exe install hamachi.inf hamachi', '', @SW_HIDE) Run(@ProgramFilesDir & '\Hamachi_Temp' & '\hamachi.exe') ;Run(@ProgramFilesDir & "\hamachi_temp" & "\hamachi.exe" & @ProgramFilesDir & "\hamachi_temp" & "\test.hamachi") ;Run(@ProgramFilesDir & '\Hamachi_Temp' & '\hamachi.exe',@ProgramFilesDir & "\Hamachi_Temp" & "\test.hamachi") ;Sleep(5000) While 1 If GuiCtrlRead(1009) = $sitename Then Run('"' & $hamachi & '\hamachi.exe" "' & $config & '"') ExitLoop EndIf Sleep(100) Wend ;RunWait('"' & $hamachi & '\hamachi.exe" "' & $config & '"') ProcessWaitClose("hamachi.exe") RunWait ( $hamachi & '\tapinstall.exe remove hamachi', '', @SW_HIDE) FileDelete ( $hamachi & '\tapinstall.exe') DirRemove ( $appdata_hamachi, 1 ) DirRemove ( $hamachi, 1 ) DirRemove ( $hamachi & '\Networks', 1 ) DirRemove ( $hamachi & '\Chat Logs', 1 ) DirRemove ( $hamachi & '\RSA Keys', 1 ) MsgBox(4096, "VPN Tunneling Closed!", "Hamachi VPN has been Shut Down and Removed from this system!") Exit Edited August 11, 2006 by MrChris Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 11, 2006 Share Posted August 11, 2006 (edited) I am trying to repackage Hamachi VPN. So far I am able to get it to run as I want it to but. I am stuck as runnging a hamachi config after the Hamachi app is opened and ControlID 1009 is set to $var. Hamachi will not Join a Network room until the Client is connected to the Hamachi Server and displays a valid $var So far this is what I have. CODE RunWait ( $hamachi & '\tapinstall.exe install hamachi.inf hamachi', '', @SW_HIDE) Run(@ProgramFilesDir & '\Hamachi_Temp' & '\hamachi.exe') ;Run(@ProgramFilesDir & "\hamachi_temp" & "\hamachi.exe" & @ProgramFilesDir & "\hamachi_temp" & "\test.hamachi") ;Run(@ProgramFilesDir & '\Hamachi_Temp' & '\hamachi.exe',@ProgramFilesDir & "\Hamachi_Temp" & "\test.hamachi") ;Sleep(5000) While 1 If GuiCtrlRead(1009) = $sitename Then Run('"' & $hamachi & '\hamachi.exe" "' & $config & '"') ExitLoop EndIf Sleep(100) Wend ;RunWait('"' & $hamachi & '\hamachi.exe" "' & $config & '"') ProcessWaitClose("hamachi.exe") RunWait ( $hamachi & '\tapinstall.exe remove hamachi', '', @SW_HIDE) Tweaked per the SmOke_N knowledge transfer related earlier: While ControlGetText("Hamachi", "", 1009) <> $sitename Sleep(100) Wend Run('"' & $hamachi & '\hamachi.exe" "' & $config & '"') If "Hamachi" is not exactly the window title, just tweak that. <Edit> ...or use the window's handle (per Mhz)! Edited August 12, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MHz Posted August 11, 2006 Share Posted August 11, 2006 ClassnameNN in all my experience is stable to use. Even normally for non english use. The others can vary. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now