Jump to content

ControlSend()


Gumma
 Share

Recommended Posts

I'm writtin a script to read data from a patient file, put it into a GUI, and then pass that information to various areas. One of the forms is an Adobe Acrobat PDF form. The problem I have is 1). I can't seem to get the program to consistantly reproduce the data from the array. If I was use ControlSend() to post the information, and Fname = Bertha, the result from the form will often be "Berth". So, I was curious if maybe I was doing smoething wrong with the array or the GUICtrlRead, but when I do _arraydisplay(), the data is correct at that point, suggesting that the error is occuring in the ControlSend() function.

I should also note, that if I run the script mutiple times in succession, the text MAY display as Bertha. The error is ... consistantly inconsistant I guess you could say. This is true for the various $Lname, $QSID, and $Fname. I've added up to Sleep(1000) between the Sends, but that also doesn't seem to change anything. Any suggestions as to why this may be or how I can improve this, please let me know!

Thanks

$QSID = GUICtrlRead ($QSIDPut, 1) ;Needed for RX Form
$Fname = GUICtrlRead ($FnamePut, 1)
$Lname= GUICtrlRead($LnamePut, 1)
$Address = GUICtrlRead($AddressPut); 
$City = GUICtrlRead($CityPut, 1); 
$State = GUICtrlRead($StatePut, 1); 
$Zip = GUICtrlRead($ZipPut, 1)
$HomeNum = GUICtrlRead($HomeNumPut, 1)
$HomeNum = GUICtrlRead($WorkNumPut, 1)
$DOB = GUICtrlRead($DOBPut, 1)
$SS = GUICtrlRead($SSPut, 1)

;region --- Begin Playing with Adobe Acrobate Files ---

WinActivate("00.") ; 00. is the name for the Window Title with the Adobe Acrobat open.

Sleep(100)
WinSetState("00.", "", @SW_MAXIMIZE)
ControlSend("00.", "", "Edit4", "100%{enter}") ;view Adobe file to 100% view (to allow for a predictiable way to view the file).
Sleep(100)
Send("{PGDN}") ;head to the bottom of the file where data will be entered

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinActivate("00.","AVTableContainerView")
WinWaitActive("00.")
Sleep(100)
;Send("{ALTDOWN}RR{ALTUP}") ;this resets the form.  Not functional in Adobe Reader - only pro.


ControlClick("00.", "", "AVL_AVView16", "left", "1", 22, 455) ;reset the form

Sleep(100)
ControlSend("00.", "", "AVL_AVView16", "{TAB}{TAB}{TAB}{TAB}{TAB}") ; This assumes that the form is the 6th field to fill out, which... isn't too ridiculous.
Sleep(300)
ControlSend("00.", "", "AVL_AVView16", $QSID) ;id#
ControlSend("00.", "", "AVL_AVView16", "{TAB}")
Sleep(300)
ControlSend("00.", "", "AVL_AVView16", $DOBSPLIT[1])
ControlSend("00.", "", "AVL_AVView16", "{TAB}")
Sleep(300)
ControlSend("00.", "", "AVL_AVView16", $DOBSPLIT[2])
ControlSend("00.", "", "AVL_AVView16", "{TAB}")
Sleep(300)
ControlSend("00.", "", "AVL_AVView16", $year)
ControlSend("00.", "", "AVL_AVView16", "{TAB}")
sleep(300)
ControlSend("00.", "", "AVL_AVView16", $Lname)
ControlSend("00.", "", "AVL_AVView16", "{TAB}")
sleep(300)
ControlSend("00.", "", "AVL_AVView16", $Fname)
ControlSend("00.", "", "AVL_AVView16", "{TAB}{TAB}")
Sleep(300)
ControlSend("00.", "", "AVL_AVView16", $City)
ControlSend("00.", "", "AVL_AVView16", "{TAB}{TAB}{TAB}")
Link to comment
Share on other sites

Probably a dumb answer but have you tried to Sleep(150) as well after sending he data to the field and before changing field with tab(s)?

If your array has valid data and the field appears randomly truncated, that might be at that point (beween back to back sends) that the tail of the string gets sent to the moon.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I see. They call it "radio-button Sleep(300)": here or there but not both!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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...