Jump to content

trouble using excel data in other app


imi
 Share

Recommended Posts

I started with AutoIt just now and running into some problems. I have an Excel sheet which contains user numbers in the first column and dates in the second. The app is used to search data for the selected user and date. The result will then be exported to a new cvs sheet. After that the next row would be read, inserted into the app and so on, until the end of the list.

I tried to use _ExcelReadCell and put the data in notepad, without any result.

Who can help me.

Link to comment
Share on other sites

All I need is to get data, beeing the OVNR and DATE from each row, starting at row 2. First the date has to be entered in the second app, then the OVNR. After that a mouse click is needed. The mouseclick isn't a problem.

Even getting the data out of excel and into notepad doesn't work.

Data in XLS:

A B

1 10050 7-3-2010

2 39455 9-3-2010

3 28854 18-4-2010

Code:

---->

#include-once

#include <Excel.au3>

#include <Array.au3>

Global $ovnr

global $date

Global $Row

Local $oExcel=(@desktopDir&"\Q_UitgeschrevenDeelnemers.xls")

_excelBookOpen($oExcel)

$ovnr = _ExcelReadArray($oExcel, 5, 1)

$date = _ExcelReadArray($oExcel, 5, 2)

$end = "End"

;Run("notepad.exe")

;winwaitactive("Naamloos - Kladblok")

;send($oExcel)

;send("{ENTER}")

;send($ovnr)

;Send("{ENTER}")

;Send($date)

;Send("{ENTER}")

;Send($end)

Run("C:\Program Files\NEDAP\Gronos Client\Gronos.exe")

WinWaitActive("Aanmelden")

;Lines deleted due to login data

WinWaitActive("Gronos Client [miciw]")

ControlClick("Gronos Client [miciw]", "", "[Class:TToolBar]", "", 1, 225, 20)

ControlSend("Gronos Client [miciw] - [Presentie/Absentie]","", "[CLASS:TcxCustomDropDownInnerEdit; INSTANCE:1]","$date")

ControlSend("Gronos Client [miciw] - [Presentie/Absentie]", "", "[CLASS:TcxCustomInnerTextEdit; INSTANCE:4]","$date")

<---- END

Ivo

Link to comment
Share on other sites

These two lines are opening your spreadsheet but not assigning the object identifier to a variable. Your references to $oExcel in the rest of the script is actually referring to a string rather than an object.

Local $oExcel=(@desktopDir&"\Q_UitgeschrevenDeelnemers.xls")

_excelBookOpen($oExcel)

They can be rewritten:

Local $excelFile=(@desktopDir&"\Q_UitgeschrevenDeelnemers.xls")

$oExcel = _excelBookOpen($excelFile)

Or Simply just 1 line:

Local $oExcel=_excelBookOpen(@desktopDir&"\Q_UitgeschrevenDeelnemers.xls")

Now when you need to access Excel using $oExcel, you refer to the object identifier instead of just the filename string.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...