Jump to content

Incremental copy in excel 2003

Recommended Posts


I have a 2 column list of data in excel that varies in length. I copy the data from this list, one cell at a time and paste it into another application (encompix) which does some other functions with the data. I would like the script to continue until the active cell is blank, and instead of writing another line for each cell how can i tell autoIT to move incrementally from the first cell for example start in a1 then b1 then a2 and b2 then a3 and b3 and continue until cell="". Here is a sample of my code. Thanks in advance for your help

$oExcel = ObjGet("","Excel.Application")
WinActivate("Job Order Browser - \\Remote")   ;switches to encompix
send("{ALT}tu")                                                    ;opens duplicator window

With $oExcel
if .activeCell="" then ExitLoop
   WinActivate("Job Order Browser - \\Remote")  
   WinActivate("Job Order Browser - \\Remote")  
   WinActivate("Job Order Browser - \\Remote")    ;switches to encompix
   send("{ALT}tu")                                                   ;opens duplicator window

Link to post
Share on other sites

Not having, or being familiar with, Emcompix, I haven't a clue about all the Send() statements, but you might try playing with a control loop something like this:

Global $oExcel, $row = 1, $col_a, $col_b

$oExcel = ObjCreate("Excel.Application")
$oExcel.Visible = 0
$oExcel.WorkBooks.Open(@ScriptDir & "test.xls")
;WinActivate("Job Order Browser - Remote")

While 1
    $col_a = $oExcel.Activesheet.Cells($row, 1).Value
    If $col_a = "" Then ExitLoop
    $col_b = $oExcel.Activesheet.Cells($row, 2).Value
    $Row += 1

ToolTip($Row - 1 & " ROWS PROCESSED")

Func Update_Encompix()
;   send("{tab}" & $col_a)
;   send("{tab}{tab}{right}{tab} & $col_B)
;   send("{enter}")
    ToolTip($col_a & "  " & $col_b)

Edit: PS - Welcome to the forum :)

Edited by Spiff59
Link to post
Share on other sites

I appreciate your time, however it didnt work for me. Im probably doing a terrible job at explaining my situation. The encompix program is just another window that duplicates, "jobs" but it will only do 1 at a time, so to speed up the process i have a 2 column list in excel with a copy from value and a copy to value. There are some parameter's to set in the window (which explains the send commands) and finally a "duplicate" button is hit, the program is slow and after hitting the button may take up to a full minute to process the function...the code i have currently written and pasted at the top works fine, but only for the first 2 value's in cell's a1 and b1, i'd like the script to continue down the list until there is no more data... im not sure if that explanation helps, hopefully i wasnt just being circumlocutious!

Link to post
Share on other sites

I'm able to park any spreadsheet (renamed test.xls) in the same directory as that test script above and when run, it will pass through the entire spreadsheet, retrieving for each row the values in column A and B until it encounters an empty Column A. For each line of the spreadsheet, I made it call the user-defined function "Update_Encompix()", which, not having the software, I just made into a simple on-screen display.

Does not this Excel portion, that parses the spreadsheet, work for you?

If not, are you getting an error of some sort?

Link to post
Share on other sites

hi this is a remake of your script using Excel.au3.

this will help u if u have the excel file on your pc.

it includes a loop jumping rows

#include <Excel.au3>
$oExcel=_ExcelBookOpen(@ScriptDir & "test.xls",0); replace path and file name
WinActivate("Job Order Browser - Remote")  ;switches to encompix
send("{ALT}tu")      ;opens duplicator window
For $i=1 to 100
If $a="" Then ExitLoop
WinActivate("Job Order Browser - Remote")
WinActivate("Job Order Browser - Remote")
WinActivate("Job Order Browser - Remote")    ;switches to encompix
send("{ALT}tu")       ;opens duplicator window

hope it helps

Link to post
Share on other sites
  • 1 month later...

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...