PixelPusher Posted June 20, 2007 Share Posted June 20, 2007 I've got a script that opens mspaint.exe and pastes a screenshot into it from the clipboard. It then tries to save the image to a specific filename. However, about half of the attempts have dropped characters during the Send(). For example: CODE$Filename = "C:\TopDir\MidDir\LowDir\FileName" Send($Filename) This leads to some pretty strange results when the directory names get munged. Is there any way, besides slowing the KeyDelay setting way down, to insure that the characters that I sent were actually received by the control? (Even with it turned down to 1000 ms it still drops characters.) Thanks! Thom Link to comment Share on other sites More sharing options...
DW1 Posted June 20, 2007 Share Posted June 20, 2007 Why dont you send it all at once? ClipPut($filename) Sleep(10) Send("^v") AutoIt3 Online Help Link to comment Share on other sites More sharing options...
evilertoaster Posted June 20, 2007 Share Posted June 20, 2007 are you sure your path does not include any escape charactors for the send command? Link to comment Share on other sites More sharing options...
DW1 Posted June 20, 2007 Share Posted June 20, 2007 (edited) did you try sending it raw with a flag of 1? Send("!@#$%^&*()a bunch of crap...", 1) or try ControlSetText() if it is applicable Edited June 20, 2007 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PixelPusher Posted June 20, 2007 Author Share Posted June 20, 2007 Holy Cow! You folks are fast! ok... 1 - there are no control or escape characters in the string. 2 - The ControlSetText function looks interesting, but I haven't tried it yet. 3 - The ClipPut() and Send("^v") seems to be working. (so far...) I'll let the sim run tonight and let you know if I've still got problems. Thanks for all the suggestions! Thom Link to comment Share on other sites More sharing options...
herewasplato Posted June 21, 2007 Share Posted June 21, 2007 You could/should check what you send (or set) in a field like that. Run this little demo:Run("mspaint.exe") WinWait("untitled - Paint") WinActivate("untitled - Paint") WinWaitActive("untitled - Paint") ;paste stuff into Paint here WinMenuSelectItem("untitled - Paint", "", "&File", "Save &As") WinWait("Save As") WinActivate("Save As") WinWaitActive("Save As") $Path = "C:\TopDir\MidDir\LowDir\FileName" ControlSetText("Save As", "", "Edit1", $Path) $PathCheck = ControlGetText("Save As", "", "Edit1") If $Path == $PathCheck Then TrayTip("$PathCheck", $PathCheck, 111) Sleep(5000) Else TrayTip("$PathCheck bad", $PathCheck, 111) MsgBox(0, "", "you lose") Exit EndIf ;more code hereA TrayTip may not be practical in the final script. You can take whatever action you wish if what you sent/set is not what "arrived". You could also check the window title for the file name to see that the save went as planned and/or do a FileExists check. hope this helps [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now