Run program using a parameter

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
papi20ver
Newbie
Posts: 10
Joined: Fri Jan 11, 2008 3:52 pm

Run program using a parameter

Post by papi20ver » Thu Feb 07, 2008 6:12 pm

Marcus
Greetings.
I´m trying run this code and keeping an error message:
Windows can´t locate ver_1.part1.exe .

Change Directory>C:\Temp\
Let>rarexe=ver_1.part1.exe
Run Program>%rarexe% -s2

Did try too:
Run Program>C:\Temp\ver_1.part1.exe -s2
and other variants.

Please, may you help me on this issue ?
Papi
Papi

GarryP
Junior Coder
Posts: 27
Joined: Sat Feb 04, 2006 12:01 pm

ExecuteFile

Post by GarryP » Tue Feb 12, 2008 7:26 pm

If you want to pass parameters, check into ExecuteFile>

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 » Wed Feb 13, 2008 2:00 am

Why two "dots" in the file name? ver_1.part1.exe

I suspect Windows is try to run a program with the extension "par"
If that is the real file name, try renaming it to something like ver_1_part1.exe
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Feb 13, 2008 2:42 am

I tried it and had no problem creating and running a compiled macro named ver_1.part1.exe but couldn't do more because compiled macros don't take parameters formatted as "-s2".

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Feb 13, 2008 5:00 am

Yes "." is now a valid multi-character in file and directory names. Whatever characters follow the last dot are used to associate the file to its appropriate application. In the ancient DOS 8.3 format the character limit after a dot was 3. Since Win95 that is no longer true. For example a file ending in .HTML (four characters) will probably open in your default browser.

Compile the following and pass all the -parameters you want.

[code]
///This will only work when compiled
Separate>%command_line%,-,par
If>par_countpar_2=None
EndIf
If>par_count=2,OnlyOne
If>par_count>2
Sub>par_count,1
Let>kk=2
Repeat>kk
Add>kk,1
Let>value=par_%kk%
Concat>par_2,%space%%value%
Until>kk>par_Count
EndIf
Label>OnlyOne
Dialog>Dialog1
Caption=Dialog1
Width=305
Height=145
Top=342
Left=373
Button=Ok,112,64,75,25,3
Label=Parameter passed was %par_2%,80,24
EndDialog>Dialog1

show>dialog1,res1

Label>EOF
[/code]

Disabled HTML
Last edited by JRL on Wed Feb 13, 2008 6:52 am, edited 4 times in total.

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 » Wed Feb 13, 2008 5:09 am

Aaargh! thanks for that reminder about extensions. :oops:
I knew that! But old work habits are hard to break. I am still supporting WIN9x clients every day.


Don't see how compiling has an effect, unless you were just trying to create an EXE with that name.

Re the message:
Windows can´t locate ver_1.part1.exe .
Is there a trailing space after the ".exe", or is that just a typo here?
Be sure the script does not have a trailing space.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Feb 13, 2008 5:32 am

Don't see how compiling has an effect, unless you were just trying to create an EXE with that name.
Yes trying to use an exe with that name but also compiling has an effect. If you don't compile, the Command_line variable will not be the file name with the parameters.

Papi,
I tried running your code with my previously posted script compiled and named to your file name and had a failure as well. I experienced your error message however, only when I specified an incorrect path to the file.

Disregard the text in yellow below. The problem was my script (above) was poorly written. It went into a continuous loop. I've altered the script and it now works correctly. Parameters will pass to it when using the code and file name supplied by Papi.

Otherwise what I saw was that the compiled script would run but the dialog would never display. I also renamed the exe to ver.exe and still failed to display the dialog. Also changed the first line of the script so that the parameter modifier was a "/" rather than a "-" and still I get the same failure of the dialog to display. With no parameters the dialog displays as expected.



Hope this isn't too confusing. Its getting late and I tend to meander....

papi20ver
Newbie
Posts: 10
Joined: Fri Jan 11, 2008 3:52 pm

Run program using a parameter

Post by papi20ver » Thu Feb 14, 2008 2:37 pm

All.
Thanks for atention. Using Winrar to split compacted files.
I did set Winrar at other way and -s2 is unnecessary now.
Cordially.
Papi

JRL wrote:
Don't see how compiling has an effect, unless you were just trying to create an EXE with that name.
Yes trying to use an exe with that name but also compiling has an effect. If you don't compile, the Command_line variable will not be the file name with the parameters.

Papi,
I tried running your code with my previously posted script compiled and named to your file name and had a failure as well. I experienced your error message however, only when I specified an incorrect path to the file.

Disregard the text in yellow below. The problem was my script (above) was poorly written. It went into a continuous loop. I've altered the script and it now works correctly. Parameters will pass to it when using the code and file name supplied by Papi.

Otherwise what I saw was that the compiled script would run but the dialog would never display. I also renamed the exe to ver.exe and still failed to display the dialog. Also changed the first line of the script so that the parameter modifier was a "/" rather than a "-" and still I get the same failure of the dialog to display. With no parameters the dialog displays as expected.



Hope this isn't too confusing. Its getting late and I tend to meander....
Papi

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