phanan Posted December 25, 2011 Share Posted December 25, 2011 (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 December 25, 2011 by phanan Link to comment Share on other sites More sharing options...
Zedna Posted December 25, 2011 Share Posted December 25, 2011 (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 ideaand instead of +{F11} use _ExcelSheetAddNew() Edited December 25, 2011 by Zedna phanan 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Optogsgap Posted December 25, 2011 Share Posted December 25, 2011 Ничего не понял Link to comment Share on other sites More sharing options...
Zedna Posted December 25, 2011 Share Posted December 25, 2011 Ничего не понялThis is ENGLISH forum! algiuxas 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Developers Jos Posted December 25, 2011 Developers Share Posted December 25, 2011 Ничего не понялWe don't understand this,oh wait... isn't that what you said too?English please algiuxas 1 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 More sharing options...
phanan Posted December 26, 2011 Author Share Posted December 26, 2011 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 ideaand 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").SelectBut how can we select all cell (juzt similar to Ctrl A)? Can u help me thix? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now