Jump to content

What does the ampersand mean in a Send command?


Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...