naru Posted July 28, 2017 Posted July 28, 2017 I have script Like This : Opt("TrayAutoPause",0) $var = Ping("www.google.com") If not @error Then WinActivate ( "testapp") ControlClick ( "testapp", "", "[Savetest]") ControlSend ( " :: Gujarat TPDS - eFPS :: Version - 2.2.0.0 - [eFPS Bill]", "", "[NAME:btnSavebyFP]", "{enter}") WinWait(":: Aadhar/EID/Verification Number Entry ::") ControlClick(":: Aadhar/EID/Verification Number Entry ::", "", "[NAME:btnNext]") If WinExists ("Aadhar : Length Check") Then ControlClick("Aadhar : Length Check", "", "[CLASS:Button; INSTANCE:1]") ControlSend(":: Aadhar/EID/Verification Number Entry ::", "", "[NAME:txtAadharNumber]", "{backspace}") ControlSend(":: Aadhar/EID/Verification Number Entry ::", "", "[NAME:txtAadharNumber]", "^v") ControlClick(":: Aadhar/EID/Verification Number Entry ::", "", "[NAME:btnNext]") WinWait(" :: Barcoded Ration Card Members - Biometric Verification/Check Utility ::") ControlSend("[Class:WindowsForms10.Window.8.app.0.378734a]", "", "[NAME:PictureBox2]", "{tab} {enter}") Sleep(5600) RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again Exit EndIf WinWait(" :: Barcoded Ration Card Members - Biometric Verification/Check Utility ::", "", 1) ControlSend("[Class:WindowsForms10.Window.8.app.0.378734a]", "", "[NAME:PictureBox2]", "{tab} {enter}") Sleep(5600) RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again Exit Else #include <MsgBoxConstants.au3> MsgBox($MB_TOPMOST, "Connection Status", "Internet is not Connected") Exit Endif
naru Posted July 28, 2017 Author Posted July 28, 2017 I have script Like This : Opt("TrayAutoPause",0) $var = Ping("www.google.com") If not @error Then WinActivate ( "testapp") ControlClick ( "testapp", "", "[Savetest]") Sleep(3000) ControlSend ( "testapp", "", "[SaveFP]", "{enter}") WinWait("Verification Entry") ControlClick("Verification Entry", "", "[Next]") If WinExists ("Check") Then ControlClick("Check", "", "[CLASS:B; INSTANCE:1]") ControlSend("Verification Number Entry ", "", "[NAME:txtNumber]", "{backspace}") Sleep(3000) RunWait("rasdial Internet", "", @SW_HIDE) Exit EndIf WinWait("Verification/Check Utility ", "", 1) ControlSend("[Class:Win.Window.84a]", "", "[PictureBox55]", "{tab}") RunWait("rasdial Internet", "", @SW_HIDE) Exit Else #include <MsgBoxConstants.au3> MsgBox($MB_TOPMOST, "Connection Status", "Internet is not Connected") Exit EndifCan i Change both Sleep(time) at once ?
InunoTaishou Posted July 28, 2017 Posted July 28, 2017 (edited) Store your sleep time in a variable Opt("TrayAutoPause", 0) Global $iSleepTime = 3000 $var = Ping("www.google.com") If Not @error Then WinActivate("testapp") ControlClick("testapp", "", "[Savetest]") $sSleepTime = 1000 Sleep($sSleepTime) ControlSend("testapp", "", "[SaveFP]", "{enter}") WinWait("Verification Entry") ControlClick("Verification Entry", "", "[Next]") If WinExists("Check") Then ControlClick("Check", "", "[CLASS:B; INSTANCE:1]") ControlSend("Verification Number Entry ", "", "[NAME:txtNumber]", "{backspace}") Sleep($sSleepTime) RunWait("rasdial Internet", "", @SW_HIDE) Exit EndIf WinWait("Verification/Check Utility ", "", 1) ControlSend("[Class:Win.Window.84a]", "", "[PictureBox55]", "{tab}") RunWait("rasdial Internet", "", @SW_HIDE) Exit Else #include <MsgBoxConstants.au3> MsgBox($MB_TOPMOST, "Connection Status", "Internet is not Connected") Exit EndIf Edit: My bad, I put $sSleepTime instead of $iSleepTime (it's late, forgive me :() Edited July 28, 2017 by InunoTaishou
naru Posted July 28, 2017 Author Posted July 28, 2017 @InunoTaishou different beetwin $sSleepTime = 1000 Global $sSleepTime = 3000
InunoTaishou Posted July 28, 2017 Posted July 28, 2017 (edited) WIthout using Global you are not explicitly declaring your variable (and initializing in this case, since we give it a value). AutoIt is a very forgiving langauge and this is okay, but it's good practice to declare your variables using Global and Local Also, use the proper prefix for the variables $sSleepTime Would be used for strings (since it starts with $s) $iSleepTime Would be used for numbers, since it starts with $i (integer) Edit: Realized I'm the one who put $sSleepTime instead of $iSleepTime Edited July 28, 2017 by InunoTaishou
naru Posted July 28, 2017 Author Posted July 28, 2017 I have script Like This : Opt("TrayAutoPause",0) $var = Ping("www.google.com") If not @error Then WinActivate ( "testapp") ControlClick ( "testapp", "", "[Savetest]") Sleep(3000) ControlSend ( "testapp", "", "[SaveFP]", "{enter}") WinWait("Verification Entry") ControlClick("Verification Entry", "", "[Next]") If WinExists ("Check") Then ControlClick("Check", "", "[CLASS:B; INSTANCE:1]") ControlSend("Verification Number Entry ", "", "[NAME:txtNumber]", "{backspace}") Sleep(3000) RunWait("rasdial Internet", "", @SW_HIDE) Exit EndIf WinWait("Verification/Check Utility ", "", 1) ControlSend("[Class:Win.Window.84a]", "", "[PictureBox55]", "{tab}") RunWait("rasdial Internet", "", @SW_HIDE) Exit Else #include <MsgBoxConstants.au3> MsgBox($MB_TOPMOST, "Connection Status", "Internet is not Connected") Exit EndifCan i Change both Sleep(time) at once ?
naru Posted July 28, 2017 Author Posted July 28, 2017 @InunoTaishou I can't Understand, Please expalin me again i want to change ; My Script Here Sleep (3000) - 1 ;My script here Sleep (3000) - 2 I want to change sleep time 1 and 2 at once
InunoTaishou Posted July 28, 2017 Posted July 28, 2017 And If you store the sleep time in a variable then it will change the sleep time for both of them. Exactly how I did it in the example I posted.
water Posted July 28, 2017 Posted July 28, 2017 Yes you can. Use a variable for the slep time and assign a new valie when needed. BTW: Please use Code Tags when posting code (the "<>" button in the editor). Makes your code easier to read. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted July 28, 2017 Posted July 28, 2017 BTW: The conditional include of th MsgBoxConstants doesn#t work this way. In a preprocessing step all #include statements are resolved and replaced by the specified file. Good practice is to move all #include statements to the top of your script. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Trong Posted July 28, 2017 Posted July 28, 2017 30 minutes ago, Nareshm said: Can i Change both Sleep(time) at once ? Assign sleep time to a variable! #include <MsgBoxConstants.au3> Opt("TrayAutoPause", 0) Global $iSleep = 3000 TrayTip("Internet", "Working....", 5) Global $var = Ping("www.google.com", 2000) If Not @error Then WinActivate("testapp") ControlClick("testapp", "", "[Savetest]") Sleep($iSleep) ControlSend("testapp", "", "[SaveFP]", "{enter}") WinWait("Verification Entry") ControlClick("Verification Entry", "", "[Next]") If WinExists("Check") Then ControlClick("Check", "", "[CLASS:B; INSTANCE:1]") ControlSend("Verification Number Entry ", "", "[NAME:txtNumber]", "{backspace}") Sleep($iSleep) MsgBox($MB_TOPMOST, RunWait("rasdial Internet", "", @SW_HIDE), "Internet is Connected", 2) Exit EndIf WinWait("Verification/Check Utility ", "", 1) ControlSend("[Class:Win.Window.84a]", "", "[PictureBox55]", "{tab}") MsgBox($MB_TOPMOST, RunWait("rasdial Internet", "", @SW_HIDE), "Internet is Connected", 2) Exit Else MsgBox($MB_TOPMOST, "Connection Status", "Internet is not Connected") Exit EndIf Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
water Posted July 28, 2017 Posted July 28, 2017 And the question is? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Trong Posted July 28, 2017 Posted July 28, 2017 Spam multiple threads with the same content! Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
water Posted July 28, 2017 Posted July 28, 2017 Did you report this "Spam"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
InunoTaishou Posted July 28, 2017 Posted July 28, 2017 Answered OP's question in a different thread earlier
Trong Posted July 28, 2017 Posted July 28, 2017 13 minutes ago, water said: Did you report this "Spam"? The report has been submitted! Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
naru Posted July 28, 2017 Author Posted July 28, 2017 @water@You@InunoTaishou How can i Delete duplicate forum ?
InunoTaishou Posted July 28, 2017 Posted July 28, 2017 Don't worry about it, a mod will close the second topic. Or we can just stop posting in it
Developers Jos Posted July 28, 2017 Developers Posted July 28, 2017 (edited) Please ONLY report threads and do not comment on it in the thread itself .... Thanks Merged: now back on topic pls. Jos Edited July 28, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators JLogan3o13 Posted July 28, 2017 Moderators Posted July 28, 2017 (edited) @VIP what benefit is there in simply parroting what InunoTaishou already said, especially when the OP obviously doesn't understand? Edit: too early in the morning, I see the threads were merged. Edit2: @Nareshm I have now found a third thread with the same question. Don't post any more, stick to one thread. Edited July 28, 2017 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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