Snuwy Posted May 17, 2015 Posted May 17, 2015 HotKeySet("{F6}", "Pause") HotKeySet ("{F5}", "Starts") HotKeySet ("{F10}", "Exits") While 1 Sleep (200) WEnd Func Exits () Exit EndFunc Func Starts () While 1 Send("aaaa") Sleep(300) WEnd EndFunc Func Pause () While 1 Sleep (200) Wend EndFunc HotKeySet("{F6}", "Pause") HotKeySet ("{F5}", "Starts") HotKeySet ("{F10}", "Exits") While 1 Sleep (200) WEnd Func Exits () Exit EndFunc Func Starts () While 1 Send("bbbbb") Sleep(500) WEnd EndFunc Func Pause () While 1 Sleep (200) Wend EndFuncHow To Combine those script in the same exe ? but when i press f5 the script will press aaaa bbbb
water Posted May 17, 2015 Posted May 17, 2015 What do you try to achieve with this script?Which program do you try to automate? 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
Snuwy Posted May 17, 2015 Author Posted May 17, 2015 What do you try to achieve with this script?Which program do you try to automate?to learn something newi don't use it on any program yet, but if i want 2 different script working the same time, i must click 2 exe.. and press different hotkeys,exe 1 start = F5exe 2 start = F4So Both file 1 and 2 working the same timebut, how can you make those 2 files into 1 executable file with 1 hotkey pressif i combine script 2 and 1 like thisFunc Starts () While 1 Send("aaaa") Sleep(300) WEnd EndFunc Func Starts () While 1 Send("bbbbb") Sleep(500) WEnd EndFuncthe script got eror duplicate line
water Posted May 17, 2015 Posted May 17, 2015 Still don't get what you try to "learn".It is very, very similar to the "problem" you posted in 2011. Did the answer work for you?Nevertheless, check AdLibRegister in the help file. 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
Snuwy Posted May 17, 2015 Author Posted May 17, 2015 (edited) Still don't get what you try to "learn".It is very, very similar to the "problem" you posted in 2011. Did the answer work for you?Nevertheless, check AdLibRegister in the help file. >.< my english still bad, it's different from what i post in 2011maybe i use pixel search in my explanationi have 2 script, snuwy1.au3 and snuwy2.au3i run scriptsnuwy1 search pixel blue when found the script play music a and sleep 3 minsnuwy2 2 search pixel red when found the script play music b and sleep 3 minhow can you mix that 2 script into only 1 script working.. example snuwy.au3 = snuwy1.au3+snuwy2.au3or maybe in snuwy.au3 thereis a script that = script in snuwy1.au3 and snuwy2.au3 working in the same time..if i combine the script in 1 file the script not run in the same time, but will wait until snuwy1.au3 done and do snuwy2.au3 Edited May 17, 2015 by Snuwy
water Posted May 17, 2015 Posted May 17, 2015 That's why I suggested function AdLibRegister.When you say PixelSearch, do you try to automate an ordinary program or a game? 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
Snuwy Posted May 17, 2015 Author Posted May 17, 2015 (edited) I used PixelSearch mostly for game, it's just examplei read the adlibregister. so if i want snuwy1 and snuwy2 working i just addFunc Starts() AdlibRegister("Snuwy1") AdlibRegister("Snuwy2") EndFuncdid adlibregister need while 1 and wend ? Edited May 17, 2015 by Snuwy
Moderators Melba23 Posted May 17, 2015 Moderators Posted May 17, 2015 Snuwy,I used PixelSearch mostly for game, it's just exampleIt might just be an example, but please read the Forum rules - particularly the bit about not discussing game automation - before you post again.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
TheBrainiac Posted May 17, 2015 Posted May 17, 2015 (edited) The original question seems innocent enough. I'll have a stab at it:If I'm not mistaken, you have two sets of functions that you'd like to merge into the same script, and you want one hotkey to run both registered functions, i.e. when you press F5, the script should run both Starts() functions you wrote.As far as I'm aware, a key combination can only be bound to one function at a time, even across multiple scripts. The easiest solution is to merge both function bodies into one: Func Starts () While 1 Send("aaaa") Sleep(300) WEnd While 1 Send("bbbb") Sleep(500) WEnd EndFunc or bind the hotkey to a new function that calls the original ones: HotKeySet("{F5}", "Starts") Func Starts() Starts1() Starts2() EndFunc Func Starts1() While 1 Send("aaaa") Sleep(300) WEnd EndFunc Func Starts2() While 1 Send("bbbb") Sleep(500) WEnd EndFunc(Of course you need exit conditions, but we're only talking examples here.)If you want both functions to be executed at the same time, you will have to either interweave the code so that the two functions proceed in an alternating fashion:While 1 Send("a") Sleep(300) Send("b") Sleep(500) WEnd(I call it 'pseudo-multithreading')Or stick to two scripts, because AutoIt does not feature true multithreading. Hope this helps! Edit: Looking at your older post water mentioned, it looks like you don't really understand program flow yet. You cannot simply put two While 1 - WEnd loops after each other. Your script will get stuck in the first loop, because "While 1" translates to "Do this until the end of forever".Furthermore, "Duplicate line" means you're trying to define two functions with the same name. This confuses the scripting engine, because it's like giving it two recipes for pie and then telling it to "make pie". It cannot decide which one to use. You need to give the two versions of your function two different names (Starts1 and Starts2), even at the cost of breaking the "symmetry" of your scripts. Edited May 17, 2015 by TheBrainiac
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