Sign in to follow this  
Followers 0
angelo88

space/quotes in run

11 posts in this topic

Good day to you all.

I am Angelo, new, and greet you all.

This is my second attempt to autoIT, and I have stumbled

upon a common problem that I solved before, and got stuck again.

All i want to do is run a commandline having a single space:

this one works perfectly in the "run" commandline of windows.

C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes

I have googled and came across solutions for multiple spaces

in filenames, and have experimented, but I have failed. even with

different kind of " and ' combinations.

My last try was:

Run("C:\angelo\emu\NES\FCEU\fceux.exe " & "PINBALL.nes")

Which only loads the "fceux.exe" part :|

Any quick hint ?

Share this post


Link to post
Share on other sites

Where is pinball.nes located?

Try setting that directory as workingdir in your run() statement.

Thank you for a fast reply and hint.

I will read the documentation for workingdir.

Tho,

fceux and pinball.nes are in the same directory. I have difficulties grasping

why a working dir is needed, the main command (fceux) has a full path given, and defaultly

looks in its working directory for "pinball.nes". All it has to do is having the

OS parse "C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes". Intriguing, thanks again.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I would first try using a variable

$var = "C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes"
Run($var)

Sounds wierd but sometimes that does the trick. Failing that, I would do this:

Run("cmd.exe")
sleep(20)
Send("C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes", 1)
Sleep(10)
ProcessClose("cmd.exe")

That's the poormans' way of doing it lol.

Edit::

There's probably a shell execute way of doing things that are more reliable.

Edited by Neno

Share this post


Link to post
Share on other sites

Thank you Neno.

Here is the fun part:

When i run C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes in windows vista's "quick command" startmenu option

it runs the executable and loads pinball.nes

When done in a commandline window, it doesnt, only the fceux process starts.

I am not smart enough for all this :idea:

i'll figure it out tho !

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I believe Run() by default sets the working directory to the scripts dir, so that could be why it fails. Please try and set the working dir as Jos suggested.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

Thank you Neno.

Here is the fun part:

When i run C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes in windows vista's "quick command" startmenu option

it runs the executable and loads pinball.nes

When done in a commandline window, it doesnt, only the fceux process starts.

I am not smart enough for all this :idea:

i'll figure it out tho !

Here you go, sorry:

ShellExecute("C:\angelo\emu\NES\FCEU\fceux.exe","PINBALL.nes")

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thank you for a fast reply and hint.

I will read the documentation for workingdir.

Tho,

fceux and pinball.nes are in the same directory. I have difficulties grasping

why a working dir is needed, the main command (fceux) has a full path given, and defaultly

looks in its working directory for "pinball.nes". All it has to do is having the

OS parse "C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes". Intriguing, thanks again.

So did you try?:

Run("C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes","C:\angelo\emu\NES\FCEU")

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted

So did you try?:

Run("C:\angelo\emu\NES\FCEU\fceux.exe PINBALL.nes","C:\angelo\emu\NES\FCEU")

Jos

That works perfectly, I see what you did there. Thank you.

The path makes sense. I will read more about it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0