Sign in to follow this  
Followers 0
phanan

ControlSend () Problem with keys CTRL SHIFT ALT

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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
1 person likes this

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

We don't understand this,

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

English please :)

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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?

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  
Followers 0