Wolfshare Posted September 28, 2013 Share Posted September 28, 2013 (edited) Hey, i want to make everything sleep till text this will show up i tried this. Do $text = ControlGetText("[CLASS:tooltips_class32]", "", "") $text2 = StringTrimRight($text, 29) $t = $t + 1 sleep(100) Until $text2 = "Connected to USA" or $t >= 70 Until $text2 = "Connected to USA" run("C:\Documents and Settings\Administrator\Desktop\random.exe") but nothing happens, it does not detect's this text just simply repeating the process, why it does not detect's those text? Edited September 28, 2013 by Wolfshare Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 I have tried changing $text2 = StringTrimRight($text, 29) number 29 to 28 but nothing hm.. strange, how can i done this script sucessful? Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 Why do you have two "Until" statements in your code? The snippet you posted will just return an syntax error. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 (edited) Why do you have two "Until" statements in your code? The snippet you posted will just return an syntax error.Yep, two untill, full code looks: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FF.au3> Global $a; Global $text; Global $text2 Global $t Opt("WinTitleMatchMode", 2) Sleep(15000) Do MouseMove(602, 587) MouseMove(794, 587) $text = 0 $text2 = 0 $t = 0 ProcessClose("StrongDial.exe") Run("C:\Program Files\StrongVPN\StrongDial.exe") WinWaitActive("StrongVPN Client (email@gmail.com", "", 180) WinActivate("StrongVPN Client (ema@gmail.com") Sleep(2000) ControlClick("StrongVPN Client (email@gmail.com)", "", "[CLASS:WindowsForms10.BUTTON.app.0.37a0697]") Do $text = ControlGetText("[CLASS:tooltips_class32]", "", "") $text2 = StringTrimRight($text, 28) $t = $t + 1 Sleep(100) Until $text2 = "You have been connected" Or $t >= 70 Until $text2 = "You have been connected" Run("C:\Documents and Settings\Administrator\Desktop\random.exe") Edited September 28, 2013 by Melba23 Added code tags and fixed indentation Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 Add some debugging code to see what you get. Means: Insert the following code after the StringTrimRight statement: ConsoleWrite(">" & $text2 & "<" & @CRLF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 28, 2013 Moderators Share Posted September 28, 2013 Wolfshare,When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags - and you keep the indentation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 (edited) Add some debugging code to see what you get. Means: Insert the following code after the StringTrimRight statement: ConsoleWrite(">" & $text2 & "<" & @CRLF) added.. does not work :/ Whole code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FF.au3> Global $a; Global $text; Global $text2 Global $t Opt("WinTitleMatchMode", 2) Sleep(15000) Do MouseMove(602, 587) MouseMove(794, 587) $text = 0 $text2 = 0 $t = 0 ; ProcessClose("StrongDial.exe") ; Run("C:\Program Files\StrongVPN\StrongDial.exe") ; WinWaitActive("StrongVPN Client (email@gmail.com", "", 180) ; WinActivate("StrongVPN Client (ema@gmail.com") ; Sleep(2000) ; ControlClick("StrongVPN Client (email@gmail.com)", "", "[CLASS:WindowsForms10.BUTTON.app.0.37a0697]") Do $text = ControlGetText("[CLASS:tooltips_class32]", "", "") $text2 = StringTrimRight($text, 28) ConsoleWrite(">" & $text2 & "<" & @CRLF) $t = $t + 1 Sleep(100) Until $text2 = "Connected to USA" Or $t >= 70 Until $text2 = "Connected to USA" Run("C:\Documents and Settings\Administrator\Desktop\random.exe") Edited September 28, 2013 by Wolfshare Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 Sure it doesn't work! We didn't change your code or remove errors but simply added a ConsoleWrite. What do you see in the SciTE output pane? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 Sure it doesn't work! We didn't change your code or remove errors but simply added a ConsoleWrite. What do you see in the SciTE output pane? Ultimate Packer for eXecutables Copyright © 1996 - 2010 UPX 3.07w Markus Oberhumer, Laszlo Molnar & John Reiser Sep 08th 2010 File size Ratio Format Name -------------------- ------ ----------- ----------- 649216 -> 301568 46.45% win32/pe New AutoIt v3 Script.exe Packed 1 file. >Exit code: 0 Time: 3.959 Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 The ConsoleWrite statement only works when you execute your script from SciTE pressing F5. The compiled version of your script has no Console to write the output to. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 The ConsoleWrite statement only works when you execute your script from SciTE pressing F5. The compiled version of your script has no Console to write the output to. >"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:Documents and SettingsAdministratorDesktopNew AutoIt v3 Script.au3" >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >Connected to USA, New York< >< >< >< >< >< Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 Now it is easy! Change lines Until $text2 = "Connected to USA" Or $t >= 70 Until $text2 = "Connected to USA" to Until $text2 = "Connected to USA, New York" Or $t >= 70 Until $text2 = "Connected to USA, New York" My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 Now it is easy! Change lines Until $text2 = "Connected to USA" Or $t >= 70 Until $text2 = "Connected to USA" to Until $text2 = "Connected to USA, New York" Or $t >= 70 Until $text2 = "Connected to USA, New York" Wow, thanks for your help! You have teached me useful thing! Link to comment Share on other sites More sharing options...
water Posted September 28, 2013 Share Posted September 28, 2013 Hope you've learned something about debugging so you can help yourself next time My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Wolfshare Posted September 28, 2013 Author Share Posted September 28, 2013 Hope you've learned something about debugging so you can help yourself next time Yep, i have learned about debugging, thanks again!!! 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