Jump to content
Sign in to follow this  
tfabris

What does the ampersand mean in a Send command?

Recommended Posts

tfabris

I had an old AutoIt script that I'm working on repurposing now for a new script. Back in the old days, it would send certain keystrokes to a commercial application. Here is a snippet:

Send("{ALTDOWN}")
   Send("&t")
   Send("&d")
   Send("&m")
   Send("{ALTUP}")
   Sleep(500)

Here's another snippet:

Send("{CTRLDOWN}")
   Send("&k")
   Send("{CTRLUP}")
   Sleep(500)

Clearly, the former is opening up the main menu with the ALT key and pressing ALT-t, d, m to select something three levels deep. The latter is trying to press the Ctrl+K hotkey in the application.

But when I looked at the online help for the "SEND" command, I don't see what the ampersand means. The help for "SEND" only shows the ampersand in relation to its main usage as a string concatenator. It doesn't say how the ampersand character is related to the letters I send in the Send command. At least, it doesn't say that as far as I can tell.

I'm sure I put them in there for a reason at some point in the past, but now I don't remember what the reason was. Now, if I remove the ampersands, the script seems to work as I expect it to work, as if the ampersands have no meaning.

Was this a feature in an older release of AutoIt that isn't there any more? What was I doing?

Share this post


Link to post
Share on other sites
JohnOne

Maybe it is a relic from "Back in the old days". No-one can tell you why you put something in a script in the old days,

Perhaps it you just wanted to send the "&", maybe it was just poor coding trying to press an accelerator key.

There could be a number of reasons. but Send("^k") would have been an easier way for the latter.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
water

When you create a menu entry the "&" is used to define the shortcut you can use to select the entry and which is then displayed with an underscore:

"F&ile" is then displayed as "File".

As the script works with and without & it seems to be ambiguous.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
tfabris

Thanks, guys! Removing the ampersands now and hoping the script Just Works.

Share this post


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
Sign in to follow this  

×