Ph03nX Posted June 10, 2007 Share Posted June 10, 2007 (edited) i have 2 keys e.g. 8 and 4 both start a function. 8 sends keys 4 sends mouselicks seperate they work fine. I click 8 i start sending keys. i click 4, i get mouseclicks. But how can i make both work at the same time. sending keys and mouseclicks! If i click 8 i cancel 4 , if i click 4 i cancel 8 I think it's cos the first function waits for the 2nd function it's loop to finish. but it wont finish it's infinte, for both functions Don't tell me to put them together in 1 function cos there's a sleep on the mouseclicks which i dont want when on the text that is send. Can any1 pleaaaase help? Thanks Edited June 10, 2007 by Ph03nX Link to comment Share on other sites More sharing options...
Mast3rpyr0 Posted June 10, 2007 Share Posted June 10, 2007 3 function then? 1 for send keys, 1 for mouseclicks and 1 for both? post your code and you might get more help My UDF's : _INetUpdateCheck() My Programs : GameLauncher vAlpha, InfoCrypt, WindowDesigner, ScreenCap, DailyRemindersPick3GeneratorBackupUtility! Other : Bored? Click Here! Link to comment Share on other sites More sharing options...
ChrisL Posted June 10, 2007 Share Posted June 10, 2007 (edited) You cant run 2 functions at the same time so you have a couple of choices. First is to put mouse clicks and keystrokes in the same function, I know you said you didn't want to because of sleeps, but don't use sleeps, user timers. While 1 $mouseTimer = TimerInit() $KeyTimer = TimerInit() If TimerDiff($MouseTimer) >= 2000 then MouseClick() etc etc $mouseTimer = TimerInit() Endif If TimerDiff($keyTimer) >= 5000 then Send() etc etc $KeyTimer = TimerInit() Endif Wend The second option you have is to write the 2 different functions as 2 different au3 files. Then have a 3rd au3 script which calles one of the other ones with hotkeys Func MouseClicker() Run (@Autoitexe & " /AutoIt3ExecuteScript Mouseclick.au3") Endfunc Edited Idiot error! Edited June 10, 2007 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
martin Posted June 10, 2007 Share Posted June 10, 2007 i have 2 keys e.g. 8 and 4 both start a function.8 sends keys 4 sends mouselicksseperate they work fine. I click 8 i start sending keys. i click 4, i get mouseclicks. But how can i make both work at the same time. sending keys and mouseclicks! If i click 8 i cancel 4 , if i click 4 i cancel 8I think it's cos the first function waits for the 2nd function it's loop to finish. but it wont finish it's infinte, for both functionsDon't tell me to put them together in 1 function cos there's a sleep on the mouseclicks which i dont want when on the text that is send.Can any1 pleaaaase help? ThanksYou might need to do something like this- (my thinking code)$t8 = timerinit()$8cycles = 0$t4 = timerinit()$4cycles = 0while 1if 8 pressed then $8 = trueif 4 pressed then $4 = trueif $8 then if timerdiff($t8) >= timedelayforkeything then do keything $t8 = timerinit() $8cycles += 1 if $8cycles = enough then $8 = falseendif $4...etc same but do clickthing..wend Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Ph03nX Posted June 11, 2007 Author Share Posted June 11, 2007 You cant run 2 functions at the same time so you have a couple of choices. First is to put mouse clicks and keystrokes in the same function, I know you said you didn't want to because of sleeps, but don't use sleeps, user timers. While 1 $mouseTimer = TimerInit() $KeyTimer = TimerInit() If TimerDiff($MouseTimer) >= 2000 then MouseClick() etc etc $mouseTimer = TimerInit() Endif If TimerDiff($keyTimer) >= 5000 then Send() etc etc $KeyTimer = TimerInit() Endif Wend The second option you have is to write the 2 different functions as 2 different au3 files. Then have a 3rd au3 script which calles one of the other ones with hotkeys Func MouseClicker() Run (@Autoitexe & " /AutoIt3ExecuteScript Mouseclick.au3") Endfunc Edited Idiot error! Can that be compiled into 1 .exe, if i'd write each function in a diffrent file? (thanks for all help so far everyone ) Link to comment Share on other sites More sharing options...
ChrisL Posted June 11, 2007 Share Posted June 11, 2007 Can that be compiled into 1 .exe, if i'd write each function in a diffrent file? (thanks for all help so far everyone ) Yes you could fileInstal() the extra scripts, or you could write them out dynamically when it runs. $string = Msgbox(0,"My Message","Hello") & @crlf & Msgbox(0,"Secondline","Another message box") FileWrite("C:\mySecondScript.au3",$string) Run (@Autoitexe & " /AutoIt3ExecuteScript C:\mySecondScript.au3") [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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