Merlin Posted September 30, 2004 Share Posted September 30, 2004 (edited) Howto execute two functions at the same time ? (sry topic title is wrong maybe some can correct that?!pls thx) is something like this possible ? : Opt("MouseCoordMode", 0) Opt("MouseClickDownDelay", 1000) ;bind two "functions" to Hotkey HotKeySet("{BACKSPACE}","click"+"move") While 1 Sleep(1) Wend ;this makes some of clicks with the clickdowntime from MouseClickDowndelay ;or i can use Sleep()´s ... we´ll see Func click() MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") EndFunc ;and this should move the mouse with its own timing Func move() $pos = MouseGetPos() MouseMove($pos[0],$pos[1]+10,5) EndFunc This example doesnt work... oh wonder lol ... its from me hehe. it has an error where i try to bind 2 funcs to a key... BUT BOTH AT THE SAME TIME !! HOW??? it should move the mouse AND click at the same time 6 times for example on its way. maybe something like?: Opt("MouseCoordMode", 0) Opt("MouseClickDownDelay", 1000) ;bind "combine" to Hotkey HotKeySet("{BACKSPACE}","combine") While 1 Sleep(1) Wend ;combine both "functions" Func combine() click() move() EndFunc ;this makes some of clicks with the clickdowntime from MouseClickDowndelay ;or i can use Sleep()´s ... we´ll see Func click() MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") MouseClick("left") EndFunc ;and this should move the mouse with its own timing Func move() $pos = MouseGetPos() MouseMove($pos[0],$pos[1]+10,5) EndFunc the above example also executes click and move AFTER EACH OTHER not at the same time ... argh i get insane ... i think include will do the same... s..t what can i do? I know about clickdrag but that has the wrong timing and just clicks one time... with wrong timing i mean : it starts to click and then it stays still for 50-90miliseconds THEN it starts movin... i need it immediatly ... and best would be with not just one click (i think i could resolve this "only one long click"problem) but not the bad timing... it should click and start movin at the same time!!!! Edited September 30, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
t0ddie Posted September 30, 2004 Share Posted September 30, 2004 maybe 2 seperate scripts running simultaneously? i know what you mean though, sometimes i want to do 2 things at once also. makes things tricky Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 can i call 2 scripts with one hotkey? i guess no ?! can i call 2 scripts with "include" from another script which contains for example Hotkey and the include ? so then one key calls these two functions at the same time?! -EDIT: i updatet my post above with another idea (the second code) what do u think? its about buildin a combine function which contains BOTH functions i wanna execute simultanuesly (man what a word rofl) EDIT 2: i tried the above idea with no success ... if it could work then my syntax is wrong... PS:i´ll try now playin around with include (i hope there is something like that... this is such a powerfull software - it cant be limited to "batchrules" - i mean this "step by step" one function after another ... i think there should be a possibility to execute/call more functions at the same time thx in Advance folks 4 ur fast replys !! *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
KnowledgeSponge Posted September 30, 2004 Share Posted September 30, 2004 I haven't tried this so I don't know if it will work but try making one of the functions, then place an adlibenable inside of that function to refer to diff function. Then adlibdisable at the end of the original function. or spawn another script with the second function you want within the original script when the function is run. Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 (edited) type slowly im german heheI haven't tried this so I don't know if it will work buttry making one of the functions, then place an adlibenable inside of that function to refer to diff function. Then adlibdisable at the end of the original function.orspawn another script with the second function you want within the original script when the function is run.<{POST_SNAPBACK}>im a totally noob to this... maybe u can post some code ? (example?)which funtions to use?what is adlibenable & adlibdisable ? (i´ll look at the docu now but maybe u could explain a bit? i would be happy to get some advice)thx mate !EDIT: i checked for ´adlibenable & adlibdisable´ but how should that help ?!-maybe i can store both functions in a variable and execute the variable? Edited September 30, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
KnowledgeSponge Posted September 30, 2004 Share Posted September 30, 2004 (edited) example hotkeyset("^1","myfunc") While 1 Sleep(2147483647) WEnd Func myfunc() adlibenable("myotherfunc",250) do stuff adlibdisable() EndFunc Func myotherfunc() do other stuff EndFunc Edited September 30, 2004 by KnowledgeSponge Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 thx 4 reply ... i go to bed and test it in about 7-8hours then ill tell if it worked.. maybe some1 elde has an idea until then?! *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
SlimShady Posted September 30, 2004 Share Posted September 30, 2004 (edited) It is possible, if you explain to us what you want.Do you want to click (multiple times) and then move the mouse ormove the mouse and then click (multiple times)? Edited September 30, 2004 by SlimShady Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 (edited) Howto execute two functions at the same time ? (sry topic title is wrong maybe some can correct that?!pls thx)<{POST_SNAPBACK}>i want two functions AT THE SAME TIME not AFTER EACH OTHER...i want to click the mouse multiple times WHILE movin(i know similar can be MouseClickDrag but that only clicks once and isnt good to configure I want someling like;bind two "functions" to Hotkey which should call them AT THE SAME TIME!! HotKeySet("{BACKSPACE}","click"+"move") While 1 Sleep(1) Wend ;this makes some of clicks with the timing controlled by Sleep´s Func click() MouseClick("left") Sleep(65) MouseClick("left") Sleep(25) MouseClick("left") MouseClick("left") Sleep(50) MouseClick("left") MouseClick("left") EndFunc ;and this should move the mouse with its own timing Func move() $pos = MouseGetPos() MouseMove($pos[0],$pos[1]+10,5) EndFuncbut that doesnt work Edited September 30, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
SlimShady Posted September 30, 2004 Share Posted September 30, 2004 What you're saying doesn't make sense.You can't click and move at the same time.BUT you can click first (once or multiple times) and then move the mouse.Here's an example that makes sense:;bind two "functions" to Hotkey which should call them AT THE SAME TIME!! HotKeySet("{BACKSPACE}","RunThis") While 1 Sleep(100) Wend ;this makes some of clicks with the timing controlled by sleeps Func MouseClickNow() MouseClick("left") Sleep(65) MouseClick("left") Sleep(25) MouseClick("left") MouseClick("left") Sleep(50) MouseClick("left") MouseClick("left") EndFunc ;and this should move the mouse with its own timing Func MoveMouseNow() $pos = MouseGetPos() MouseMove($pos[0],$pos[1]+10,5) EndFunc Func RunThis() MouseClickNow() MoveMouseNow() EndFunc Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 (edited) nah it makes sense but maybe this isnt possible to do with simple scripting like we do here ... i have to think about it..EXAMPLE:I just want to move the mouse -lets say 500pixel downwards with a speed of 25pixel/second. (its called [,speed] in AutoIT i´ll have to figure out which speed fits my needs)AND WHILE THE MOUSE MOVES it should click more then one time (not clickdrag!) - just a click -lets say every second/25pixel or whatever i´ll enter in the Sleep() between the: MouseClick("left") Sleep(50) MouseClick("left")----------------------heres another idea how maybe it could work:scriptC.au3 -binds hotkey[c] to 2 other Hotkeys[a + b] (something like that possible? i know syntax is wrong its just to show what i mean...):basicscripts:scriptA.au3:HotKeySet("{F1}","move") While 1 Sleep(1) Wend Func move() $pos = MouseGetPos() MouseMove($pos[0],$pos[1]+10,5) EndFuncscriptB.au3:HotKeySet("{F2}","click") While 1 Sleep(1) Wend ;this makes some of clicks with the timing controlled by sleeps Func click() MouseClick("left") Sleep(65) MouseClick("left") Sleep(25) MouseClick("left") MouseClick("left") Sleep(50) MouseClick("left") MouseClick("left") EndFuncideas for the scriptC.au3:1:HotKeySet("{BACKSPACE}","{F1}+{F2}") While 1 Sleep(1) Wendor(workin with variables?!)2:HotKeySet("{BACKSPACE}","combine") While 1 Sleep(1) Wend func combine() $myvar = ({F1}+{F2}) execute=($myvar) EndFuncREMEMBER I KNOW THIS IS WRONG SYNTAX ITS ONLY TO SHOW WHAT I MEAN !!!i hope u can tell me a solution to this...or binding 2 scripts to 1 Hotkey?! (in that case there wouldnt be any hotkey setteing in script A+B...just simple funtioncalls)HotKeySet("{BACKSPACE}","{scriptA.au3}+{scriptB.au3}") While 1 Sleep(1) Wend Edited September 30, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
JSThePatriot Posted September 30, 2004 Share Posted September 30, 2004 (edited) Listen I understand what you are wanting... you are wanting a mouse to keep moving in a direction while it is clicking.. why cant you send a move for 25 pixels... send a click and do that in a loop until it has ended up where you want it? Would that not work? Edit: I havent worked much with mouseclick()'s yet. I plan on it in the near future. I have a project that needs it. I will let you know if I dig up something new. What I said above will work. JS Edited September 30, 2004 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 (edited) i need the clicks WHILE movin not one after another ... i understand what u mean but if u think about mousemovement u will understand that i need clickDOWNandHOLD for specific time WHILE movin because it has to drag stuff around... (mouseclickdrag doesnt fit my needs ... i need a long move down and some clicks in it ...) maybe LARRY can say how he made his clickdrag because maybe theres a way to configure it to do what i want?! I would be interested in his opinion about this whole problem .. if this doesnt work (execute 2 or more whatever functions AT THE SAME TIME) because maybe this is something he should think about for the next version or just an update/plugin whatever ... im not a procoder... LAAAAAAAARRYYYY we need ur help ! Edited September 30, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
Merlin Posted September 30, 2004 Author Share Posted September 30, 2004 sorry im german ..i dont understand this:(maybe someone can explain and check if this would combine two scripts?!)Dim / Global / Local --------------------------------------------------------------------------------Declare a variable or create an array.Dim $variableDim $array[subscript 1]...[subscript n] Parameters$variable The name of the variable to declare. subscript The number of elements to create for the array dimension, indexed 0 to n-1. RemarksThe Dim/Local/Global keywords perform a similar function.1. Declare a variable before you use it (similar to VBScript)2. Create an arrayNote: In AutoIt you can create a variable simply by assigning a value ($myvar = 0) but many people like to explicitly declare them.You can also declare multiple variables on a single line:Dim $a, $b, $cAnd pre-initialize, if variable is not an array:Dim $a = 2, $b, $c = 20The difference between Dim/Local/Global is the scope in which they are created:Dim = Local scope if the variable name doesn't already exist globally (in which case it reuses the global variable!)Global = Forces creation of the variable in the Global scopeLocal = Forces creation of the variable in the Local/Function scopeWhen using variables the local scope is checked first and then the global scope second.When creating arrays you are limited to up to 64 dimensions and/or a total of 16 million elements. (Technical: The internal table of 4 bytes per element is allocated at the time of creation, but the actual memory for each element is ONLY allocated on that elements first use).A unique feature is the ability to copy arrays like this:$mycopy = $myarrayIn this case $mycopy will be an exact copy of $myarray and will have the same dimensions - no Dim statement is required first. If the variable $mycopy was already an array or value it will be erased before the copy takes place.To erase an array (maybe because it is a large global array and you want to free the memory), simply assign a single value to it:$array = 0This will free the array and convert it back to the single value of 0.Dim for the same variable name will erase and reset the dimensions to the new definition. RelatedUBound, ReDim Example; Example 1 - Declaring variablesDim $x, $y = 23, $zGlobal $PI = 3.14159, $RADIUSLocal $daysWorking = 5; Example 2 - Declaring arraysDim $weeklyWorkSchedule[$daysWorking]Global $chessBoard[8][8]Local $mouseCoordinates[2], $windowStats[4] *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
KnowledgeSponge Posted September 30, 2004 Share Posted September 30, 2004 Dude, just separate the two functions into separate scripts and spawn the second from the original when the hotkey is pressed... Link to comment Share on other sites More sharing options...
Merlin Posted October 1, 2004 Author Share Posted October 1, 2004 (edited) so AutoIT cant do that .. its a pitty Larry didnt say a word to this ... maybe he has an idea... -your idea sounds good ?! how to do? which functions? im leaning sry ----- Edited October 1, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
Guest BL@(K-R34P3R Posted October 1, 2004 Share Posted October 1, 2004 I's not sure, but isn't it possible to set a hotkey so that you can press it once to run a function, twice to pause a funciton, and a third time to stop a function? If this is true, then you can effective set it up in two scripts, either A) pause the function until the second has started, or on the first script, set it to open the second and start it, but not activate itself till it checks if ProcessExists(). Link to comment Share on other sites More sharing options...
Merlin Posted October 1, 2004 Author Share Posted October 1, 2004 (edited) yes that is possible (start stop pause button for a script) ill try Process exist (hmm it uses a timing of 250ms thats hard... ill have to see if this fits my needs...) Edited October 1, 2004 by Merlin *----Greets---MerliN---->www.ALLyaNEED.de German HelpBoard<-----* Link to comment Share on other sites More sharing options...
Guest BL@(K-R34P3R Posted October 1, 2004 Share Posted October 1, 2004 Good luck. Just have it check to see if the second process (script) is running, then if it is, then start your first script. That will make them go at the same time =) Link to comment Share on other sites More sharing options...
KnowledgeSponge Posted October 1, 2004 Share Posted October 1, 2004 (edited) HotKeySet("^1","myfunc") While 1 Sleep(2147483647) WEnd Func myfunc() Run("myotherscript.exe","C:\myotherscriptsfolder\") do some stuff ProcessClose("myotherscript.exe") EndFunc Why does this have to be done separately anyways? You realize that if you coded it in one script like others have stated it would be the same either way? Edited October 1, 2004 by KnowledgeSponge 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