Problem with command line arguments

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bernie
Junior Coder
Posts: 47
Joined: Sun Sep 22, 2002 4:16 pm
Location: Virginia

Problem with command line arguments

Post by bernie » Fri Jun 10, 2005 9:33 pm

I discovered that msched does *NOT* pass through command line arguments when you invoke a macros directly. that is, I tried:
> fixfile.scp /filename=


and it didn't work and it took me a while to figure out WHY. To get it to work I had to type:
> C:\program files\mjtnet\macroscheduler\msched d:\macros\fixfile.scp /filename=


What a mess to have to type! [this with 7.3.11.4 on XP/Pro]. Is there something wrong with my setup [I don't recall doing
anything much except telling the installer to associate .scp files with msched]? Or a bug/misfeature?
/Bernie\

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jun 11, 2005 1:21 am

It appears that Macro Scheduler executable and the macro script file are not in the same working directory, defautl paths.

I suspect that is why you must provide the complete path.

HELP section on calling macros mentions the need to provide complete path of the macro file.

Why not make a shortcut with the correct values so you only need to double-click on the icon vs. typing that long strng.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

bernie
Junior Coder
Posts: 47
Joined: Sun Sep 22, 2002 4:16 pm
Location: Virginia

Post by bernie » Sat Jun 11, 2005 1:28 am

Bob Hansen wrote:It appears that Macro Scheduler executable and the macro script file are not in the same working directory, defautl paths. .
That's correct -- msched is in a read-only directory on my C drive and my macros are all in appropriate directories accessible from my limited user account.
HELP section on calling macros mentions the need to provide complete path of the macro file.
You're missing the point: when I run "somemacro.scp" from the command line, the macro runs perfectly. BUT: msched won't pass command line
arguments into the macro [which I think is a bug!].
Why not make a shortcut with the correct values so you only need to double-click on the icon vs. typing that long strng.
That's not the problem: I need to provide a command-line argument. I suppose I could create a new shortcut every time I want to feed the macro a different filename, but that's really pretty ugly and inconvenience. Typing that gigantic string [with full paths both to msched and to the macro] is also incredibly ugly and inconvenient . What I was asking was why:
macro.scp /filename=SOMEFILE
won't pass the command-line arg: it will run the macro just fine, but the macro *always* starts up with no command-line args [so I can't pass vbs in]
/Bernie\

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jun 11, 2005 1:40 am

Still trying to create an easy workaround.
------------------------
How about a batch file that takes the parameter?

FixFile.bat contents:

Code: Select all

C:\program files\mjtnet\macroscheduler\msched d:\macros\fixfile.scp /filename=%1
Run batch file with filename as parameter:

Code: Select all

FixFile.bat <SOMETHING>
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

bernie
Junior Coder
Posts: 47
Joined: Sun Sep 22, 2002 4:16 pm
Location: Virginia

Post by bernie » Sat Jun 11, 2005 12:13 pm

Yes, that'll do it... and I guess that's the sort of thing that I'll have to do.. thanks!

I wonder if/how this is supposed to work in general. I see that the file-association for .scp files is basically the same as the association for other types of files [basically PATHTOMSCHED %1] I don't know enough about that part of windows to know if there's some '%' thing you can put in for "the rest of the arguments" or some such.. oh well, the batch file will do fine... thanks!
/Bernie\

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