Command Line Use

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Dominic_Fichera
Pro Scripter
Posts: 82
Joined: Mon Mar 24, 2014 12:15 pm

Command Line Use

Post by Dominic_Fichera » Thu Oct 09, 2014 7:36 am

Hey guys,

What's the best way to use the command line to execute a command using Macro Scheduler? I've downloaded a program to extract a PDF file to text via command line. I've confirmed I have the right code and can run it natively through the command line, but don't know how to use it in Macro Scheduler.

Should it looks something like this:

Code: Select all

RunProgram>cmd /c textextract [PDF FILE] /to [Export Location]
If so, when I run the script, the command line opens and then errors out saying something like
"Unhandled Exception: System.ArgumentOutofRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension"
Thanks in advance for your help :)

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Command Line Use

Post by Marcus Tettmar » Thu Oct 09, 2014 10:15 am

The most common cause of problems is missing QUOTES:

You need to do something like

Run>cmd.exe /C ".. Your Command Goes in quotes here .."

And you may need quotes within the quotes.

E.g. if there are spaces in PDF FILE and EXPORT LOCATION you'd want further quotes round them. So you might have something like:

Run>cmd.exe /C "textextract "c:\my stuff\some pdf file.pdf" /to "c:\my other place" "

So you have quotes around the entire line being passed to cmd.exe, and quotes *within* that line around parms that might need spaces.

Basically whatever works manually in the console needs to go within quotes after cmd.exe /c
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Dominic_Fichera
Pro Scripter
Posts: 82
Joined: Mon Mar 24, 2014 12:15 pm

Re: Command Line Use

Post by Dominic_Fichera » Thu Oct 09, 2014 10:20 am

Hi Marcus,

Thanks for your reply :)

I'm still having the same issue, so I think it must be a computer error. I'll try exporting it, trying it on another PC and if I'm still having dramas, I'll post back :)

Kind regards,

Dominic Fichera

User avatar
CyberCitizen
Automation Wizard
Posts: 723
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Command Line Use

Post by CyberCitizen » Fri Oct 10, 2014 1:33 am

One thing I noticed and if your using 64bit machines and compling scripts to exe's is to call it like I have below.

I tend to have more luck doing it that way.

Code: Select all

Run>%SYS_NATIVE%\cmd.exe /c net user /domain allenm01 | Find "Account active" > %TEMP_DIR%AcctChk.csc
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts