SevenScript 1 Posted January 23 Share Posted January 23 Hey, doing small stuff in AutoIt just for training and feeling nice with it. Have already script builded for my needes, but asking you guys for help with Turn ON/OFF Func. #include <misc.au3> HotKeySet("1", "start") HotKeySet("2", "stop") Func start(); MouseDown("middle") EndFunc Func stop(); MouseUp("middle") EndFunc Looking for solution to switch Mouse down/up with 1 key Link to post Share on other sites
SOLVE-SMART 110 Posted January 23 Share Posted January 23 Hi @SevenScript, I guess you are looking for a toggle function. Please search the forum for toggle and you will get examples that are similar to your question. I don't have enough time at the moment to script a quick script as an example, because I am in rush. Maybe later today. Best regards Sven SevenScript 1 Stay innovative! Spoiler 🌍 Au3Forums 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔍 Forum search 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to post Share on other sites
ioa747 36 Posted January 23 Share Posted January 23 maybe help SevenScript 1 Link to post Share on other sites
ioa747 36 Posted January 23 Share Posted January 23 (edited) and when tray no needed this just with HotKey #include <misc.au3> Local $Enabled, $SleepTime Enabled() While 1 Sleep($SleepTime) WEnd Func start(); ;MouseDown("middle") MouseWheel("down") EndFunc Func stop(); ;MouseUp("middle") MouseWheel("up") EndFunc Func Enabled() if $Enabled = True Then $Enabled = False $SleepTime = 1000 HotKeySet("1") HotKeySet("2") Else $Enabled = True $SleepTime = 10 HotKeySet("{ESC}", "Enabled") HotKeySet("1", "start") HotKeySet("2", "stop") EndIf ConsoleWrite("$Enabled=" & $Enabled & @CRLF) EndFunc Edited January 23 by ioa747 SevenScript 1 Link to post Share on other sites
Solution SOLVE-SMART 110 Posted January 23 Solution Share Posted January 23 (edited) To be honest @ioa747, I was actually thinking about such toggle function: HotKeySet('{ESC}', '_Exit') HotKeySet('1', '_ToggleMouse') Global $bIsDown = False Func _Exit() Exit EndFunc Func _ToggleMouse() $bIsDown = Not $bIsDown If $bIsDown Then MouseDown('middle') Return EndIf MouseUp('middle') EndFunc While True Sleep(200) WEnd Simply press "1" to do the mouse down ("middle" key) action and press "1" again for the mouse up action (and again and again 😅). I think this is exactly what @SevenScript wanted to know, am I right? Best regards Sven Edited January 23 by SOLVE-SMART ioa747 1 Stay innovative! Spoiler 🌍 Au3Forums 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔍 Forum search 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to post Share on other sites
SevenScript 1 Posted January 23 Author Share Posted January 23 Yes @SOLVE-SMART, That's exactly what i was missing, Thank you so much, @ioa747 Your post are also helpfull.. Gives materials to study :D, Thanks guys ioa747 1 Link to post Share on other sites
ioa747 36 Posted January 24 Share Posted January 24 @SOLVE-SMART You have right ! my eye stayed to On 1/23/2023 at 6:10 AM, SevenScript said: but asking you guys for help with Turn ON/OFF Func than in On 1/23/2023 at 6:10 AM, SevenScript said: Looking for solution to switch Mouse down/up with 1 key Thanks for suggestions. Link to post Share on other sites
SOLVE-SMART 110 Posted January 24 Share Posted January 24 You're welcome @ioa747 🤝 . Stay innovative! Spoiler 🌍 Au3Forums 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔍 Forum search 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to post Share on other sites
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