StudioMaker Posted July 3, 2017 Share Posted July 3, 2017 Yeh, how do i have the both key on hotkeyset to both start and stop a script? Or not stop the whole script , just stop the func? Link to comment Share on other sites More sharing options...
StudioMaker Posted July 3, 2017 Author Share Posted July 3, 2017 Same* xD Link to comment Share on other sites More sharing options...
orbs Posted July 3, 2017 Share Posted July 3, 2017 the operation of doing both start and stop depending on current status is called "toggle". assign the desired key to a function which holds a global (or local static) boolean var. the script is running and initializing said var to True. when the function is called, it checks for the var, if True it stops the script and sets the var to False, and vice-versa. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted July 3, 2017 Share Posted July 3, 2017 Try something like this HotKeySet("{F1}", "_Toggle") Global $iToggle = 0 While 1 Sleep(10) WEnd Func _Toggle() If Mod($iToggle, 2) = 0 Then SplashTextOn("", "Currently On") $iToggle +=1 Else SplashOff() $iToggle +=1 EndIf EndFunc Link to comment Share on other sites More sharing options...
StudioMaker Posted July 3, 2017 Author Share Posted July 3, 2017 Thanks! Link to comment Share on other sites More sharing options...
StudioMaker Posted July 3, 2017 Author Share Posted July 3, 2017 Or actuually, In my script thing that i currently have it did not work, I have so that you have to write an key and Click a checkbox and the key you writed is the hotkey and for some reason, it did not work Global $iToggle = 0 Func _Key() $Var1 = GUICtrlRead($Input2) HotKeySet($Var1, "_Toggle") while 1 sleep(10) WEnd EndFunc While 1 Sleep(10) WEnd Func _Toggle() While 1 send("{SPACE UP}") sleep(27) send("{SPACE DOWN}") sleep(15) Wend If Mod($iToggle, 2) = 0 Then SplashTextOn("", "Currently On") $iToggle +=1 Else SplashOff() $iToggle +=1 EndIf EndFunc Link to comment Share on other sites More sharing options...
StudioMaker Posted July 3, 2017 Author Share Posted July 3, 2017 Or like the key can start but not stop* Link to comment Share on other sites More sharing options...
Danp2 Posted July 3, 2017 Share Posted July 3, 2017 Your script as posted either isn't complete or doesn't make sense. I'm guessing you only posted a portion of the code because you've defined a function _key, but it never gets executed. Also, once _Toggle gets called, it will get stuck in the While loop. You should move this loop to some other portion of your script, something like -- Global $iToggle = 0 _Key() While 1 sleep(10) If $iToggle Then send("{SPACE UP}") sleep(27) send("{SPACE DOWN}") sleep(15) Endif WEnd Func _Key() $Var1 = GUICtrlRead($Input2) HotKeySet($Var1, "_Toggle") EndFunc Func _Toggle() $iToggle = Not $iToggle EndFunc Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
StudioMaker Posted July 4, 2017 Author Share Posted July 4, 2017 Ye ty i did just sent a little bit of the script cus it is very big. Link to comment Share on other sites More sharing options...
StudioMaker Posted July 4, 2017 Author Share Posted July 4, 2017 (edited) Doe, It dont seems to work correctly. When i type in the key and then click the checkbox and then click the key the whole thing just shuts.. I would really need help. GUICtrlSetData(-1, "| By StudioMakerVFX! :)|(Notice, If you use any of these hacks, there is a risk to get banned)|here"&Chr(39)&"s my tradelink: https://steamcommunity.com/tradeoffer/new/?partner=120292336&token=6aPnqwgi|If u want to support me with skins (Donations are very appreciated)|MOTD: Have fun with xD :) /StudioMaker") Edited July 4, 2017 by Jos Link to comment Share on other sites More sharing options...
Developers Jos Posted July 4, 2017 Developers Share Posted July 4, 2017 @StudioMaker, Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. (there is also a link in my signature) Please read them now particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. 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. Link to comment Share on other sites More sharing options...
Recommended Posts