Jump to content


Photo

RunWait parameters


  • Please log in to reply
21 replies to this topic

#1 azure

azure
  • Members
  • 1203 posts

Posted 05 April 2012 - 08:19 AM

hello!

I want to run a program (pdftotext.exe) to process the files of a folder

F1::
Loop, C:\pdf\*.pdf
;A_LoopFileLongPath will contain the name of the file each time loop runs
RunWait, pdftotext.exe, C:\bin32
; I see in the examples and /c what is it?
; how do I add the parameters for pdftotext.exe ? eg output file, etc

thanks!

#2 CodeKiller

CodeKiller
  • Members
  • 2066 posts

Posted 05 April 2012 - 10:19 AM

F1::
RunWait Notepad.exe "this is a test file.txt"
Msgbox Notepad exited !
Return

F2::
File = test.bmp
RunWait Mspaint.exe "%File%"
Msgbox Mspaint exited !
Return

So :
RunWait FILE.EXE PARAM1 PARAM2 PARAM3
If needed enclose the PARAM with " ".

#3 azure

azure
  • Members
  • 1203 posts

Posted 05 April 2012 - 12:43 PM

RunWait, “pdftotext.exe -f 1 -l 1 -layout 1 1.txt”, E:\pdf\bin32\
?

#4 CodeKiller

CodeKiller
  • Members
  • 2066 posts

Posted 05 April 2012 - 12:51 PM

>_>

Do I kill myself now ???

Do you see "," in my example ?

RunWait pdftotext.exe -f 1 -l 1 -layout 1 "1.txt" "E:\pdf\bin32"

Don't use , and use " only for parameters wich can contain spaces in it "like filename)

A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk), or system verb to launch (see remarks). If Target is a local file and no path was specified with it, A_WorkingDir will be searched first. If no matching file is found there, the system will search for and launch the file if it is integrated ("known"), e.g. by being contained in one of the PATH folders.

To pass parameters, add them immediately after the program or document name. If a parameter contains spaces, it is safest to enclose it in double quotes (even though it may work without them in some cases).



#5 JSLover

JSLover
  • Members
  • 920 posts

Posted 05 April 2012 - 01:19 PM

RunWait, “...”
...those are "smart quotes"...aka...what I call "dumb quotes" (they won't work for code, but I don't like them anyway)...where did you type your message that caused them?...if it's only a glitch when typing on the forum, it's OK (you should still fix it tho, as it's confusing), but if those "special" quotes are in your real code, you'll have problems...

When you need quotes, use the normal quotes...

RunWait, "..."
...& here they are, bigger, for comparison...
Smart Quotes: “ ”
Normal Quotes: " "...remember: smart quotes do not work in code.

#6 azure

azure
  • Members
  • 1203 posts

Posted 06 April 2012 - 07:35 AM

okay

the original format is this:

In cmd, we type:
pdftotext.exe -f 1 -l 1 -layout <pdf_file_input> <text_file_output>

the exe to be run is a DOS program, so I need the "%comspec% /c" at the begining, but what is /c really? I didnt find any documentation about it

anyway, then, it should be:
RunWait %comspec% /c E:\pdf\bin32\pdftotext.exe -f 1 -l 1 -layout %A_LoopFileLongPath% %A_LoopFileName%.txt

right?

#7 garry

garry
  • Members
  • 2596 posts

Posted 06 April 2012 - 10:01 AM

need the "%comspec% /c" at the begining, but what is /c really?

open DOS window (cmd) and type cmd /? ( then see help to this DOS-command )
/c = close DOS
/k = keep DOS window open when command executed

see also hide (ahk-command)

#8 azure

azure
  • Members
  • 1203 posts

Posted 08 April 2012 - 10:13 PM

this doesnt work:

RunWait %comspec% /c E:\pdf\bin32\pdftotext.exe -f 1 -l 1 -layout input.pdf output.txt

it just flashes a cmd window

any hint?

#9 garry

garry
  • Members
  • 2596 posts

Posted 09 April 2012 - 07:47 AM

as mentioned above , command hide
RunWait %comspec% /c E:\pdf\bin32\pdftotext.exe -f 1 -l 1 -layout input.pdf output.txt,,hide


#10 azure

azure
  • Members
  • 1203 posts

Posted 09 April 2012 - 05:35 PM

RunWait %comspec% /c E:\pdf\bin32\pdftotext.exe -f 1 -l 1 -layout input.pdf output.txt,,hide


it simply doesnt work!
:S:S:S
any hint?

#11 HotKeyIt

HotKeyIt
  • Fellows
  • 6132 posts

Posted 09 April 2012 - 05:52 PM

This works for me:
RunWait C:\Program Files\xpdfbin-win-3.03\bin32\pdftotext.exe -f 1 -l 1 -layout input.pdf output.txt,,hide


#12 azure

azure
  • Members
  • 1203 posts

Posted 09 April 2012 - 08:37 PM

yes, it works now

but why it doesnt work in this context?

Loop, C:\Documents and Settings\Administrator\Desktop\New Folder\*.pdf
{
RunWait C:\Documents and Settings\Administrator\Desktop\test\pdftotext.exe -f 1 -l 1 -layout -enc UTF-8 %A_LoopFileLongPath% %A_LoopFileLongPath%.txt,,hide
}

it should generate all *.pdf.txt files inside New Folder

#13 Leef_me

Leef_me
  • Moderators
  • 7704 posts

Posted 09 April 2012 - 08:46 PM

it should generate all *.pdf.txt files inside New Folder

That may be what you want, but that is not what you programmed the script to do.

WorkingDir
The working directory for the launched item. Do not enclose the name in double quotes even if it contains spaces.
If omitted, the script's own working directory (A_WorkingDir) will be used.



#14 HotKeyIt

HotKeyIt
  • Fellows
  • 6132 posts

Posted 09 April 2012 - 08:48 PM

Try quotes for filenames :?:
Loop, C:\Documents and Settings\Administrator\Desktop\New Folder\*.pdf

{

RunWait "C:\Documents and Settings\Administrator\Desktop\test\pdftotext.exe" -f 1 -l 1 -layout -enc UTF-8 "%A_LoopFileLongPath%" "%A_LoopFileLongPath%.txt",,hide

}


#15 azure

azure
  • Members
  • 1203 posts

Posted 09 April 2012 - 09:08 PM

Try quotes for filenames :?:


that worked

but after that, the below line did not work:
FileMove, %A_LoopFileLongPath%, %A_LoopFileDir%%SampleID%.pdf

any hint?