Greetings, all.
I just ran across a problem that took me a while to solve, and thought I'd
share it.
We needed to automate a PDF printer. Using SendKeys() almost worked.
Unfortunately,
the developer was tricky and put in a variable number of fields, so we
couldn't
just tab a certain number of times.
I noticed that only 1 field was enterable & contained text - all the
others
were buttons or checkboxes. So, using cut/paste, I was able to tell when
I was on the correct field to type in my file name.
HTH,
Jim Moseley
;---------
var tempStr, pdfPrefixCur string endVar
tempStr = ""
if not tempStr.writeToClipBoard() then ; clear the clipboard
errorShow("Write blank to Clipboard")
return
endif
loopI = 0
while true
sendkeys("{delay 50}{tab}^{insert}",true) ; tab & copy (ctrl-insert)
if not tempStr.readFromClipboard() then
errorShow("Read value from Clipboard")
return
endif
if tempStr <> "" then ; something returned - success!
quitloop
endif
loopI = loopI + 1
if loopI > 100 then
quitloop
endif
endWhile
if loopI > 100 then
return
endif
if not pdfPrefixCur.writeToClipboard() then
errorShow("Write value to clipboard")
endif
sendkeys("{delay 100}+{insert}{enter}",true) ; paste (****ft-insert)
sleep(3000) ; let it do its thing
;-----


|