soeber Posted January 24, 2010 Share Posted January 24, 2010 Hi guys, im a bit new to this program, but i think im getting a hang on it.. I am making a script to copy values from excel and paste it into Updatepatrol, but for some reason it script dossent do what i tell it to. so far i have made this script :; While 1 Winactivate ("Microsoft Excel","") Sleep(50) Send ("{CTRLDOWN}C{CTRLUP}{Down}") Winactivate ("UpdatePatrol","") Sleep(50) MouseClick("left",39,63) Send ("{CTRLDOWN}V{CTRLUP}{SHIFTDOWN}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}C{CTRLUP}{TAB}{CTRLDOWN}V{CTRLUP}{ENTER}") Sleep(50) WEnd It only react to the "Winactivate"(program) and the {Down} code, not any of the other, or the mouse click Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 24, 2010 Share Posted January 24, 2010 (edited) Use the _Excel* UDFs (i.e. _ExcelReadCell(), see help file) for getting the data. Find out the control ID where you want the data (AU3Info.exe), and use ControlSend() to put it there. Edited January 24, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
soeber Posted January 24, 2010 Author Share Posted January 24, 2010 (edited) Thnaks, i tryed the excel code, but dont know if i understood it right.. Woud be nice if you coud drop some exambles on how it shud look, its pretty difficult to figure it out by myself since im not so fammiiar with programming Im not sure i found the right control ID but is it this ?>>>> Control <<<<Class: TTBXToolbarInstance: 3ClassnameNN: TTBXToolbar3Name: Advanced (Class): [CLASS:TTBXToolbar; INSTANCE:3]ID: 67116 <----- Text: ToolbarActionsPosition: 0, 25Size: 480, 26ControlClick Coords: 37, 12Style: 0x56000000ExStyle: 0x00010000Handle: 0x0001062CWhile 1Winactivate ("Microsoft Excel","")Sleep(50)_ExcelReadCell ($oexcel, $rangeorrow [, $icolumn = 1] (NEEDS TO CONTINUE UNTILL ROW NUMBER 1500)Send ("{CTRLDOWN}C{CTRLUP}{Down}")Winactivate ("UpdatePatrol","")Sleep(50)MouseClick("left",39,63)Send ("{CTRLDOWN}V{CTRLUP}{SHIFTDOWN}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{SHIFTUP}{CTRLDOWN}C{CTRLUP}{TAB}{CTRLDOWN}V{CTRLUP}{ENTER}")Sleep(50)WEndMy colums from excel are listed below eachother like ;LinkLinkLinkLink-so i figured the Copy and down woud work just as good ? Edited January 24, 2010 by soeber Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 25, 2010 Share Posted January 25, 2010 You got the right stuff on the control. The script would be more like this: #include <Excel.au3> $sXLS = "C:\MyData\MyWorkbook.xls" $oExcel = _ExcelBookOpen($sXLS) ; or _ExcelBookAttach() if already open $aData = _ExcelReadArray ($oexcel, 1, 1, 1500, 1, 1) ; Read column data from A1 thru A1500 to an array For $n = 1 To UBound($aData) - 1 ControlSend("UpdatePatrol", "", "[CLASS:TTBXToolbar; INSTANCE:3]", $aData[$n]) Sleep(1000) Next Compare to the help file examples for each of those functions. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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