jarhead > 2020-10-22 09:00
Jean Lalonde > 2020-10-22 15:17
MsgBox, % "Nb. of arguments = " . A_Args.Length() . "`nArgument 1 is: " . A_Args[1]
jarhead > 2020-10-22 15:58
(2020-10-22 15:17)Jean Lalonde Wrote: Hi,
This trick would work with any scripting language that can process command line parameters. In your case, see this AHK help page: https://www.autohotkey.com/docs/Scripts.htm#cmd
For example, with a script like this:
Code:MsgBox, % "Nb. of arguments = " . A_Args.Length() . "`nArgument 1 is: " . A_Args[1]
In QAP, create an Application favorite for the location of your .ahk script. In the Advanced parameters, enter {SEL_NAME} (between double quotes it the arg may contain spaces.
Click any file or folder, open the QAP menu and select your favorite.
Et voilà ;-)
Jean
PDDoc := ComObjCreate("AcroExch.PDDoc")
PDDoc.Open(A_Desktop "\Test\Test.pdf")
PDDoc2 := ComObjCreate("AcroExch.PDDoc")
PDDoc2.Open(A_Desktop "\Test\Test2.pdf")
PDDoc2.InsertPages(-1, PDDoc, 0, PDDoc.GetNumPages, 1) ; index-0, add at beginning from PDDoc all pages with bookmarks
PDDoc2.Save(1, A_Desktop "\Test\Test_Merge.pdf")
PDDoc.Close()
PDDoc2.Close()
PDDoc2.Open(%1%)
Jean Lalonde > 2020-10-22 16:04
jarhead > 2020-10-22 16:09
(2020-10-22 16:04)Jean Lalonde Wrote: Hi,
I stopped using the old %1% variables. I recommend the A_Args object that is much easier to deal with, especially when you code with expressions (as you do).
I can't to go too deep on AHK scripting here. This is a bit out of scope on this forum. You could find more help on the AHk forum https://www.autohotkey.com/boards/. In what QAP is concerned, you probably do what is required. Test your AHK script from the command line with the file location as parameter. When it will work this way, it will be easy to move it to QAP.
Jean
jarhead > 2020-11-03 10:15
RunWait %comspec% /c pdftk "C:\myfile.pdf" output "%A_Desktop%\%A_MM%-%A_dd%-%A_YYYY%.pdf" user_pw "%A_YYYY%%A_MM%%A_dd%" allow printing "dont_ask", , hide
Jean Lalonde > 2020-11-03 12:05
RunWait %comspec% /c pdftk "C:\myfile.pdf" output "%A_Desktop%\%A_MM%-%A_dd%-%A_YYYY%.pdf" user_pw "%A_YYYY%%A_MM%%A_dd%" allow printing "dont_ask", , hide
strCommand := comspec . " /c pdftk " . A_Args[1] . " output """ . A_Desktop . "\" . A_MM . "-" . A_dd . "-" . A_YYYY . ".pdf"" user_pw """ . A_YYYY . A_MM . A_dd . """ allow printing ""dont_ask"""
MsgBox, %strCommand% ; just to test the result
RunWait, %strCommand%, , hide
jarhead > 2020-11-03 12:17