Jump to content

IsPressed LShift key number


Go to solution Solved by Danp2,

Recommended Posts

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

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

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 by Dan_555

Some of my script sourcecode

Link to post
Share on other sites

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 by SOLVE-SMART

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...