The following code gives me inconsistent results. Sometimes the string is sent correctly, but sometimes it is sent with minor variations. The latest one was supposed to send the following string:
"C:\_Work1\Dispense_Before.txt", but it sent this instead:
"C:|_Work1\Dispense_Before.txt". Close, but not quite, although, the same string is displayed in a msgbox at the end, and it was displayed correctly. In this case, it is sending the string to an Edit box in a Save As dialog, but I got the same results when sending strings to TMemo controls, too.
$saveAsName = $workLoc & $arTables[$tableIndx] & $suffix
$doesItExist = FileExists($saveAsName)
ControlSend("Save As", "", "[CLASS:Edit; INSTANCE:1]", $saveAsName)
ControlClick("Save As", "", "[CLASS:Button; INSTANCE:2]")
;if the file had already existed, then we will need to Confirm its replacement
if $doesItExist Then
ControlClick("Save As", "", "[CLASS:Button; INSTANCE:1]")
EndIf
Sleep(3000)
MsgBox(0, "File Saved", "File Saved as: " & $saveAsName)
Maybe I should mention that before this, the script is copying very large amounts of text to and from the clipboard. I have put what seems to be sufficient sleep() delays to allow the copy and pasting to complete. I have tested with extremely long delays, with the same inconsistent results.
Thanks,
Pete S