Jump to content
Sign in to follow this  
soeber

My script dossent work

Recommended Posts

soeber

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

Share this post


Link to post
Share on other sites
PsaltyDS

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.

:D

Edited 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

Share this post


Link to post
Share on other sites
soeber

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 :D

Im not sure i found the right control ID but is it this ?

>>>> Control <<<<

Class: TTBXToolbar

Instance: 3

ClassnameNN: TTBXToolbar3

Name:

Advanced (Class): [CLASS:TTBXToolbar; INSTANCE:3]

ID: 67116 <-----

Text: ToolbarActions

Position: 0, 25

Size: 480, 26

ControlClick Coords: 37, 12

Style: 0x56000000

ExStyle: 0x00010000

Handle: 0x0001062C

While 1

Winactivate ("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)

WEnd

My colums from excel are listed below eachother like ;

Link

Link

Link

Link

-

so i figured the Copy and down woud work just as good ?

Edited by soeber

Share this post


Link to post
Share on other sites
PsaltyDS

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.

:D


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

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  

×