Jump to content

Can I tell the script to ignore the shift key?


Recommended Posts

Im having a problem with a script not working while im holding down the shift key. Is their anyway I can tell the script to ignore the shift key? Thanks

Welcome to the AutoIt forum!

Post the simplest script that exhibits this behavior.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Here it is. I hit f1, it hits ctrl+variable then 1 then ctrl+variable. It works fine without shift down but doesnt work while holding shift.

Read again the help under Send(). It insists that : "Function SendSome programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!"

Try something along this line (untested):

Func F1 ( )
Local $leftShift = _isPressed("A0")
Local $rightShift = _isPressed("A1")
If $leftShift Then Send("{LSHIFT up}")
If $rightShift Then Send("{RSHIFT up}")
 Send( "^" & $a )
 Send( "1" )
 Send( "^" & $b )
If $leftShift Then Send("{LSHIFT down}")
If $rightShift Then Send("{RSHIFT down}")
 EndFunc

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Read again the help under Send(). It insists that : "Function SendSome programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!"

Try something along this line (untested):

Func F1 ( )
Local $leftShift = _isPressed("A0")
Local $rightShift = _isPressed("A1")
If $leftShift Then Send("{LSHIFT up}")
If $rightShift Then Send("{RSHIFT up}")
 Send( "^" & $a )
 Send( "1" )
 Send( "^" & $b )
If $leftShift Then Send("{LSHIFT down}")
If $rightShift Then Send("{RSHIFT down}")
 EndFunc

Thanks for the reply!

Im getting an error that says

Local $leftShift = _isPressed("A0")

Local $rightShift =^ERROR

Error:Unkown function name.

I guess I need to define what those are? This is a bit over my head hehe.

Link to comment
Share on other sites

Thanks for the reply!

Im getting an error that says

Local $leftShift = _isPressed("A0")

Local $rightShift =^ERROR

Error:Unkown function name.

I guess I need to define what those are? This is a bit over my head hehe.

In this case, the help is always there! You need to insert this line with other #includes, before your code and variables:

#Include <Misc.au3>

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

In this case, the help is always there! You need to insert this line with other #includes, before your code and variables:

#Include <Misc.au3>

Sorry, so I should just put that at the top exactly like it is or should the name be different? I read the autoit docs about include but im a bit confused. I put it exactly like that at the top, everything worked but the function still didnt work while shift was down.

Link to comment
Share on other sites

everything worked but the function still didnt work while shift was down.

It's possible the program you're sending keystrokes to monitors the keyboard at a lower level, or there is something specific with it. What program is it? And why do you maintain shift down precisely at this moment?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

It's possible the program you're sending keystrokes to monitors the keyboard at a lower level, or there is something specific with it. What program is it? And why do you maintain shift down precisely at this moment?

The program is a game and shift is the sprint button. Basically I would like to be able to use these hot keys while holding down shift to sprint.
Link to comment
Share on other sites

The program is a game and shift is the sprint button. Basically I would like to be able to use these hot keys while holding down shift to sprint.

I see. Games often use low-level or uncomon tricks. I've no good answer for you then, sorry.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...