Jump to content
Sign in to follow this  

ControlSend / ControlSetText

Recommended Posts

Good Afternoon

I have tried to search as much as I can but I was not able to easily find the answers that I was looking for, perhaps because it is not possible.

I am trying to automate the install of a complicated piece of software that the Vendors say is not possible to automate and it is recommended to install from CD. ;-)

Anyway part of the install requires me to browse to a network location where the Database is stored, but the piece of script that I am trying to use doesn't fully enter.

ControlSend('Medtronic CareLink Pro - InstallShield Wizard', '', 'Edit2', 'Mtwdfsv01DeptEmServDiabeticsDiabetes CentreCareLinkPro-DBcarelink.cldb', 1)

but it doesn't always enter the

I have also tested ControlSetText('Untitled - Notepad', '', 'Edit1', 'Mtwdfsv01DeptEmServDiabeticsDiabetes CentreCareLinkPro-DB')

and the above script doesn't seem to work.

I have tested it in notepad and it works fine. :-)

Any advice or direction would be greatly appreciated as this is my first time using Auto it and until this point has been fantastic.


Share this post

Link to post
Share on other sites

What doesn't work.  You have no error handling, so you are in the dark.

I'd suggest you wait for the window to exist, and grab the handle that's returned...then wait for the control to exist, and grab the handle...then use the controlsettext with the handles captured.

Error handling all along the way, so you know exactly which piece is failing.

Simple example

$hWin = WinWait("[CLASS:Notepad]","",5)
If Not IsHWnd($hWin) Then
    MsgBox(1,1,"not able to get window")
    Exit 1

$hControl = ControlWait($hWin, 15, 5)
If Not IsHWnd($hWin) Then
    MsgBox(1,2,"not able to get control handle")
    Exit 2

ControlFocus($hWin, "", $hControl)
If Not ControlSetText($hWin, "", $hControl,"\\somevalue\to\some\area.txt") Then
    MsgBox(1,3,"not able to ControlSetText")
    Exit 3

Func ControlWait($hWindow,$Control,$iSecTimeout)
    $hControl = ControlGetHandle($hWindow,"",$Control)
    If Not IsHWnd($hControl) Then
        $iTimer = TimerInit()
            $hControl = ControlGetHandle($hWindow,"",$Control)
        Until IsHWnd($hControl) Or TimerDiff($iTimer)>$iSecTimeout*1000
    Return $hControl
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  

  • Create New...