 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Keksz
Joined: 15 Jul 2009 Posts: 1
|
Posted: Wed Jul 15, 2009 10:28 am Post subject: Full automated copy-paste between two applications |
|
|
Hi there,
I have an excel sheet with columns filled with information, row-by-row.
I have created a very simple script which copy/paste the information from excel to an other application. I need to copy a row, and AutoHotkey paste all the info in the right fields on the other application (I used TAB to jump between the fields, SPACE to change drop-down-menus, etc), at the end AutoHotkey pushs the button: "ADD" and the values will be added to the 2nd application, and a new screen show up, where I can add new data.
But I need to have this full automatically, it means I copy-paste only the first row from the excel, data will be transfered to the 2nd application, after ADD, and the empty form is showed AutoHotkey jumps back to excel, go 1 row down, do the copy automatically, jumps to the 2nd application and execute paste. Until there is a row left in excel. Row-by-row!
Is it possible?
Right now I do this copy/paste manually, but sometimes I have 300-400 rows in the excel sheet.
Cheers,
Keksz |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Wed Jul 15, 2009 12:28 pm Post subject: |
|
|
- Use a Loop to repeat the actions
- and/or look at ControlSend to send the copied date to the other application in the background _________________ AHK Wiki FAQ
TF : Text files & strings lib, TF Forum |
|
| Back to top |
|
 |
hutch@edge.net
Joined: 16 Sep 2008 Posts: 77
|
Posted: Wed Jul 15, 2009 8:25 pm Post subject: |
|
|
Hugo is right. A loop should do it for you. Be sure to set enough sleep between each step to allow for processing.
Here are a couple of other tricks that might help. If the name of your Excel file is not always the same, you can tell AHK to use the "active" Excel file, (the one that is active when you run your script), no matter what the name of the file is. Just add this code to the top of your script:
| Code: |
xlid:=WinExist("A")
GroupAdd, XLCOPY, ahk_id %xlid%
|
and then, when jumping back to excel to get the next line of data, this code will do it:
| Code: |
WinWait, ahk_group XLCOPY,
IfWinNotActive, ahk_group XLCOPY, , WinActivate, ahk_group XLCOPY,
WinWaitActive, ahk_group XLCOPY,
|
Also, if the number of loops will vary, and you want an input box to prompt you for the quantity of loops to perform, add this code to the top:
| Code: |
InputBox, Loops, How many line items do you need to delete?
Loop, % Loops
{
;Enter code here.
}
Exit
|
Hope this helps. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|