SevenScript 1 Posted January 23 Share Posted January 23 Hello, https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm A0 Left SHIFT key <- Thats what they say But when i use A0 in script "While 1 If _IsPressed(0A) Then While _IsPressed(0A) send("Script looping") WEnd" AutoIt Gives me error Unable to parse line. It happens when i using Keys with letters for example A0, A1, A2, 5B etc. 79 F10 key 7A F11 key So when i put 79 -> Script works fine with F10 But when i put 7A script won't start Link to post Share on other sites
Solution Danp2 1,360 Posted January 23 Solution Share Posted January 23 The hex value representing the key should be contained within quotes. SevenScript 1 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
SevenScript 1 Posted January 23 Author Share Posted January 23 Yea thanks for answer.. Works with that but another problem appears Quote #include <misc.au3> HotKeySet("1", "start") HotKeySet("2", "stop") Func start(); send("{LShift down}") EndFunc Func stop(); send("{LShift up}") EndFunc While 1 If _IsPressed("A0") Then While _IsPressed("A0") send("looping") sleep(200) WEnd EndIf Sleep(200) WEnd #RequireAdmin Have something like that. When i press "1" Script looping But after "2" script still looping.. i need to press LShift with my keyboard to stop that Link to post Share on other sites
Danp2 1,360 Posted January 23 Share Posted January 23 That makes sense if you think about it. You've forced the Shift key to be held down, so pressing 2 is actually registered as @. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
SevenScript 1 Posted January 23 Author Share Posted January 23 How can i force the Shift key to go UP then with second function? And force it down again with first? Link to post Share on other sites
Dan_555 127 Posted January 23 Share Posted January 23 (edited) You will have to change the stop hotkey. on the german keyboard (which i'm using) the Shift 2 is the " char. so here i would replace the Quote HotKeySet("2", "stop") with Quote HotKeySet('"', "stop") you have to see which char is on the shift 2 and place it insead of " (i guess it is the @ char, as @Danp2 said) Edited January 23 by Dan_555 SevenScript 1 Some of my script sourcecode Link to post Share on other sites
SevenScript 1 Posted January 23 Author Share Posted January 23 Okey works perfectly xD Link to post Share on other sites
SOLVE-SMART 110 Posted January 24 Share Posted January 24 (edited) Just to complete this here, out of the suggestion/answer by @Dan_555, it would look like the following: HotKeySet('{ESC}', '_Exit') HotKeySet('1', '_ToggleLeftShift') HotKeySet('{!}', '_ToggleLeftShift') Global $bIsDown = False Func _Exit() Exit EndFunc Func _ToggleLeftShift() $bIsDown = Not $bIsDown If $bIsDown Then Send('{LSHIFT DOWN}') Return EndIf Send('{LSHIFT UP}') EndFunc While True Sleep(200) WEnd Please notice, that I use this example because @SevenScript also had another question about it here. This is a combination of a toggle function with the SHIFT key problem (which is solved by the statement of @Dan_555 above) 👍 . Best regards Sven Edited January 24 by SOLVE-SMART Dan_555 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
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