SevenScript Posted January 23, 2023 Share Posted January 23, 2023 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 comment Share on other sites More sharing options...
Solution Danp2 Posted January 23, 2023 Solution Share Posted January 23, 2023 The hex value representing the key should be contained within quotes. SevenScript 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SevenScript Posted January 23, 2023 Author Share Posted January 23, 2023 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 comment Share on other sites More sharing options...
Danp2 Posted January 23, 2023 Share Posted January 23, 2023 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 @. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
SevenScript Posted January 23, 2023 Author Share Posted January 23, 2023 How can i force the Shift key to go UP then with second function? And force it down again with first? Link to comment Share on other sites More sharing options...
Dan_555 Posted January 23, 2023 Share Posted January 23, 2023 (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, 2023 by Dan_555 SevenScript 1 Some of my script sourcecode Link to comment Share on other sites More sharing options...
SevenScript Posted January 23, 2023 Author Share Posted January 23, 2023 Okey works perfectly xD Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted January 24, 2023 Share Posted January 24, 2023 (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, 2023 by SOLVE-SMART Dan_555 1 Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) 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