Jump to content

ControlSend () Problem with keys CTRL SHIFT ALT


phanan
 Share

Recommended Posts

Hi everyone!

I hav a script which used some ControlSend commands to send something (Ctrl a, Ctrl c, Shift F11 & Ctrl v) to the Excel Book. It works, but sometimes it does not work and I dont really understand. I searched a lot, and got information about this problem, but it juzt happen only to the Cezch keyboards. Here I use English keyboard

I post an example code here. So can anyone help me to solve this or suggest a new solution to make Select (Ctrl a), Copy (Ctrl c), Create New Sheet (Shift F11) & Paste (Ctrl v)?

#include <Excel.au3>
$oExcel = _ExcelBookNew()
for $i = 1 to 20 step 1
for $j = 1 to 10 step 1
  _ExcelWriteCell($oExcel, "x", $i, $j)
Next
Next
ControlSend("Microsoft Excel - Book1", "", "", "^a")
ControlSend("Microsoft Excel - Book1", "", "", "^c")
ControlSend("Microsoft Excel - Book1", "", "", "+{F11}")
ControlSend("Microsoft Excel - Book1", "", "", "^v")
;"[CLASS:EXCEL7; INSTANCE:1]"
Edited by phanan
Link to comment
Share on other sites

There is known bug/limitation in Send/ControlSend with national keyboards, escpecially with Czech one.

One workaround is to switch keyboard to english then use Send/ControlSend and then switch it back.

More elegant solution in your example is to use COM commands for all desired actions instead of Send/ControlSend.

Search MSDN for Range/Copy/Paste and look at Excel.au3 sources to get idea

and instead of +{F11} use _ExcelSheetAddNew()

Edited by Zedna
Link to comment
Share on other sites

  • Developers

Ничего не понял

We don't understand this,

oh wait... isn't that what you said too?

English please :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

There is known bug/limitation in Send/ControlSend with national keyboards, escpecially with Czech one.

One workaround is to switch keyboard to english then use Send/ControlSend and then switch it back.

More elegant solution in your example is to use COM commands for all desired actions instead of Send/ControlSend.

Search MSDN for Range/Copy/Paste and look at Excel.au3 sources to get idea

and instead of +{F11} use _ExcelSheetAddNew()

Thanx for suggesting me about COM commands (this is first time i heard about this)

For MSDN, to select a cell we use: $oExcel.Application.ActiveSheet.Range("A1").Select

But how can we select all cell (juzt similar to Ctrl A)? Can u help me thix?

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