Sign in to follow this  
Followers 0
ORyan

ODBC Data Source Automation Script

3 posts in this topic

Hello, I am working on an AUTOIT script to automate the manual setup process of an ODBC Data Source using the Microsoft Visual FoxPro Driver.

I already wrote a hard coded script to setup a data source. The problem is the driver I need is not located in the same position on every computer.

What I am trying to do is make it dynamic for use with all Windows O/S's. I have the two following questions, and don't know which way will work or which is possible...

1) How can you get the currently selected text of a listbox via an HWND?

-OR-

2) How can I obtain an array of all the items within the listbox via HWND, that way I can get the index of the list item?

The list view I am trying to access is found by doing the following...

-> Press 'Windows Key' + 'R'

-> Enter "odbcad32.exe"

-> Click 'Add...'

The Add New Data Source Wizard will pop up, it contains a list of drivers available on the computer to choose from.

In order to test this you will need to download and install the ODBC Data Source Driver for Microsoft Visual FoxPro from Microsoft.

http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx

You will also need to create an db called EI in Microsoft Visual FoxPro, or download and extract the attached EI.zip file to your C:\ directory. When extracted the file structure should resemble "C:\EI\DATA\EI.DBC".

Attached is the code I wrote to setup an ODBC Data Source using the Microsoft Visual FoxPro Driver is attached as ODBC.au3.

Thank you,

O'Ryan

EI.zip

ODBC.au3

Share this post


Link to post
Share on other sites



Hello, I am working on an AUTOIT script to automate the manual setup process of an ODBC Data Source using the Microsoft Visual FoxPro Driver.

I already wrote a hard coded script to setup a data source. The problem is the driver I need is not located in the same position on every computer.

What I am trying to do is make it dynamic for use with all Windows O/S's. I have the two following questions, and don't know which way will work or which is possible...

1) How can you get the currently selected text of a listbox via an HWND?

-OR-

2) How can I obtain an array of all the items within the listbox via HWND, that way I can get the index of the list item?

The list view I am trying to access is found by doing the following...

-> Press 'Windows Key' + 'R'

-> Enter "odbcad32.exe"

-> Click 'Add...'

The Add New Data Source Wizard will pop up, it contains a list of drivers available on the computer to choose from.

In order to test this you will need to download and install the ODBC Data Source Driver for Microsoft Visual FoxPro from Microsoft.

http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx

You will also need to create an db called EI in Microsoft Visual FoxPro, or download and extract the attached EI.zip file to your C:\ directory. When extracted the file structure should resemble "C:\EI\DATA\EI.DBC".

Attached is the code I wrote to setup an ODBC Data Source using the Microsoft Visual FoxPro Driver is attached as ODBC.au3.

Thank you,

O'Ryan

Automating that GUI is the hard way. I know, because I did it about two years ago. :)

Instead, just create\edit the registry keys in HKLM\SOFTWARE\ODBC\ODBCINST.INI\ to add\check drivers, and DSNs at HKLM\SOFTWARE\ODBC\ODBC.INI\{DSN_Name}.

:)


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

Thank you, for the tip on enumerating the keys from the registry. That worked great.

O'Ryan

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  
Followers 0