jmp Posted July 29, 2019 Posted July 29, 2019 When i trying to print/save as pdf using cutePDF Writer, having an issue where the cutePDF Writer (https://www.cutepdf.com/Products/CutePDF/writer.asp) save as dialog box stays hidden until the user interacts (clicks some part of the screen or presses a key). Here is Little example : #include <IE.au3> $iname = "ExampleForm" Local $oIE = _IE_Example("form") _IELoadWait($oIE) _IEAction ($oIE,"printdefault") WinWait ("Save As", "Move up to CutePDF Pro and get advanced control over your PDF documents. Easily merge && split PDFs, add security, digital signature, stamps, bookmarks or header/footer, make booklets, n-Up, save PDF forms, scan to PDF and more!") WinActivate ("Save As", "Move up to CutePDF Pro and get advanced control over your PDF documents. Easily merge && split PDFs, add security, digital signature, stamps, bookmarks or header/footer, make booklets, n-Up, save PDF forms, scan to PDF and more!") ControlSetText("Save As", "", "[CLASS:Edit; INSTANCE:1]", $iname) Its possible to show save as dialog box using autoit ? If Yes then How ? But When i use Winwait without text and WinSetState Like this : #include <IE.au3> $iname = "ExampleForm" Local $oIE = _IE_Example("form") _IELoadWait($oIE) _IEAction ($oIE,"printdefault") WinWait ("Save As") WinSetState ("Save As", "", @SW_SHOW) ControlSetText("Save As", "", "[CLASS:Edit; INSTANCE:1]", $iname) save as dialog box showing but not properly because some interface does not showing until the user interacts (clicks some part of the screen or presses a key) and ControlSetText does not set a text.
seadoggie01 Posted August 24, 2019 Posted August 24, 2019 (edited) I often work with Save As dialog boxes like this: ;~ "Get the handle of the save as dialog box" Local saveAsWindow = WinWait("Save As", "") ;~ "Activate the window" WinActivate($saveAsWindow, "") ;~ "Wait for it to actually be active" WinWaitActive($saveAsWindow, "") ;~ "Try to set the control's text, if it fails..." If Not ControlSetText($saveAsWindow, "", "[CLASS:Edit; INSTANCE:1]", @ScriptDir & "\temp.pdf") Then ;~ "... try with control send" ControlSend($saveAsWindow, "", "[CLASS:Edit; INSTANCE:1]", @ScriptDir & "\temp.pdf") EndIf Sometimes I can't get ControlSetText to work, so I check for an error and use control send if it fails. If everything fails, then you can try using SendKeepActive and Send, but that shouldn't happen. Edited August 24, 2019 by seadoggie01 Comments are horrid in online syntax highlighter All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
jmp Posted August 24, 2019 Author Posted August 24, 2019 7 hours ago, seadoggie01 said: I often work with Save As dialog boxes like this: ;~ "Get the handle of the save as dialog box" Local saveAsWindow = WinWait("Save As", "") ;~ "Activate the window" WinActivate($saveAsWindow, "") ;~ "Wait for it to actually be active" WinWaitActive($saveAsWindow, "") ;~ "Try to set the control's text, if it fails..." If Not ControlSetText($saveAsWindow, "", "[CLASS:Edit; INSTANCE:1]", @ScriptDir & "\temp.pdf") Then ;~ "... try with control send" ControlSend($saveAsWindow, "", "[CLASS:Edit; INSTANCE:1]", @ScriptDir & "\temp.pdf") EndIf Sometimes I can't get ControlSetText to work, so I check for an error and use control send if it fails. If everything fails, then you can try using SendKeepActive and Send, but that shouldn't happen. @seadoggie01 your problem and my problem is different. I have problem with cutepdf save as dialog.
seadoggie01 Posted August 24, 2019 Posted August 24, 2019 8 hours ago, jmp said: @seadoggie01 your problem and my problem is different. I have problem with cutepdf save as dialog. No, I'm not having an issue. I was posting some code that I use with "Save As" dialog boxes and I thought you might like to try it All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
jmp Posted August 25, 2019 Author Posted August 25, 2019 9 hours ago, seadoggie01 said: No, I'm not having an issue. I was posting some code that I use with "Save As" dialog boxes and I thought you might like to try it But i am not facing with controlsend or controlset problems, i have problem to activate save as dialog.
jmp Posted August 27, 2019 Author Posted August 27, 2019 19 minutes ago, snuffking said: Perhaps it's worth trying to change the editor? Will you have the same problem with this one, for example https://pdf.movavi.com/? No, i have only problem with cutepdf.
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