Jump to content

ControlSend sending Alt, Shift.....


jokke
 Share

Recommended Posts

Heya, ime stuggling abit to make my ControlSend send Both Shift and F1 at once.

These things iwe tried:

ControlSend("win","","","+{F1}")
;------------------------------------------

ControlSend("win","","","{SHIFTDOWN}{F1}")
ControlSend("win","","","{SHIFTUP}")
;------------------------------------------

ControlSend("win","","","{SHIFTDOWN}")
ControlSend("win","","","{F1}")
ControlSend("win","","","{SHIFTUP}")
;------------------------------------------

oh, i tried with both send flags (0/1).

As a sidenote, if i activate the window then use:

WinActivate("win","")
Sleep(100)
Send("+{F1}")

That works, but having to activate the window means the process will interfere with other thing's as im trying to automate this task.

Any ideas?

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

The first example should work. But what you are missing is the ControlId.

ControlSend("win","",ControlId,"+{F1}")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

Theres no control, thats why its blank :)

Well i am sending single keys just fine, but once i start mixing up more keystrokes at once it just wont send em.

ControlSend("win","","","+{F1}") Results sending F1 but not the Shift.

As i worte as a side note, when i activate the window and use Send it works.

Edited by jokke
UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

See Remarks of ControlSend: " ...works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window."

To send key strokes to an active window use Send. To send key strokes to an inactive window use ControlSend and specify a ControlId.

So I think what you want (send key strokes to an inactive window) can't be done.

For further info please see this post.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

  • 14 years later...

Can someone explain why

ControlSend("win","","","+{F1}")

doesn't work

whereas

ControlSend("win","","","{F1}")
Send("+{F1}")
Send("{F1}")

works well?

 

The discussion here resulted in the statement that you need a ControlID, but didn't answer all questions.

So in other words:

Why does a missing ControlID block using modifiers like "+" etc? What's the actual reason? May it be application dependend?

Of course there's always a workaround but it's nicer to have a straightforward way.

Link to comment
Share on other sites

14 years ago, I don't remember how AutoIt was performing with ControlSend, but today it works well with/without ControlId.  Do some tests you will see by yourself...

Edited by Nine
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...