se7enGBSk Posted June 18, 2010 Share Posted June 18, 2010 hey is there a way to repeat a sentence, without writing the whole stuff again ? like on sentence nr 7. i have send("TEXT") and i want to repeat the same on nr 40. next time it needs to send("TEXT1") and i dont want to edit everything again and again tnks for any help Link to comment Share on other sites More sharing options...
water Posted June 18, 2010 Share Posted June 18, 2010 That's what functions are for. But in your case it wouldn't save you a lot. 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...
se7enGBSk Posted June 18, 2010 Author Share Posted June 18, 2010 the text is much longer and all together i have 2 repeat the sentence about 10 times . and i dont want to edit 10 sentence next time . Link to comment Share on other sites More sharing options...
water Posted June 18, 2010 Share Posted June 18, 2010 (edited) If you have to repeat lines of code at different places of your script a function is definitely the way to go. If the text changes pass the whole text or just the changing part to the function and do what processing it needs in the function. If you can provide a code snippet then it's much easier to help Edited June 18, 2010 by water 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...
se7enGBSk Posted June 18, 2010 Author Share Posted June 18, 2010 If you have to repeat lines of code at different places of your script a function is definitely the way to go. If the text changes pass the whole text or just the changing part to the function and do what processing it needs in the function. If you can provide a code snippet then it's much easier to help ok here is a part of the cod Run("C:\Programme\uTorrent\uTorrent.exe") sleep(1000) send("^n") sleep(500) [b] send("C:\Dokumente und Einstellungen\All Users\Dokumente\Eigene Musik\Beispielmusik") [/b] ........... send("{tab}") send("{enter 2}") WinWaitActive("Speicherort für .torrent wählen.") winactive("Speicherort für .torrent wählen.") send("{enter}") the thing is i need the send("C:\Dokumente und Einstellungen\All Users\Dokumente\Eigene Musik\Beispielmusik") several times now. an next time its maybe : D:\dontknow\here\... ( thats y i want to repeat it, because so i just need to edit it once and not several times ) Link to comment Share on other sites More sharing options...
water Posted June 18, 2010 Share Posted June 18, 2010 (edited) Ok, in this case I would use variables. Global $Loc_BM = "C:\Dokumente und Einstellungen\All Users\Dokumente\Eigene Musik\Beispielmusik" Global $Loc_DK = "D:\dontknow\here\..." send($Loc_BM) ; <== Line 7 ........... send($Loc_BM) ; <== Line 40 So there is only one place in your script for the strings. You change it only once. Edited June 18, 2010 by water 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...
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