Jump to content

Can't get script to execute program


Recommended Posts

I am using this line

Run ( @ProgramFilesDir & "\Mozilla Firefox\firefox.exe",@SW_MAXIMIZE)

It won't work with firefox, however, if I replace the same spots with internet explorer and iexplore.exe it launches internet explorer.  Any ideas as to why it won't work with firefox?

Is there a better command to use instead of this one?

 

-JimJam5x

Link to comment
Share on other sites

  • Developers

That won't work when you run it with AutoIt3.exe and requires autoit3_64.exe! 
When you have the full SciTE4AutoIt3 installed you could use the directive:

#AutoIt3Wrapper_UseX64=y

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Alright Thanks! I'll give that a try.  For future knowledge, is there a reason the same line works with internet explorer with the "same" directory and code. 

C:\Program Files\Internet Explorer

Run ( @ProgramFilesDir & "\Internet Explorer\iexplore.exe",@SW_MAXIMIZE)

Link to comment
Share on other sites

  • Developers

Guess that is also available in a 32bit version in  "C:\Program Files (x86)\Internet Explorer" ...right? ;)

@ProgramFilesDir =  "C:\Program Files (x86)" in x86 mode
@ProgramFilesDir =  "C:\Program Files" in x64 mode
 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This compiled script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=TestFF.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

$pid = Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe","",@SW_MAXIMIZE)
MsgBox(0,"PID",$pid,5)

works for me. In script mode (x86 compatible) it does also. But in first try the Directives aren't set.

Edited by AutoBert
Link to comment
Share on other sites

33 minutes ago, Jos said:

That won't work when you run it with AutoIt3.exe and requires autoit3_64.exe! 
When you have the full SciTE4AutoIt3 installed you could use the directive:

#AutoIt3Wrapper_UseX64=y

Jos

I have uninstalled the old editor and downloaded the full version.  How do I use this directive? 

I also tried "function run" that I found on autoitscript.com but still no success, not sure if it doesn't work for the same reasons as above.  Could also be writing the line wrong.

run ( "firefox.exe" , "C:\Program Files\Mozilla Firefox")

Link to comment
Share on other sites

54 minutes ago, AutoBert said:

This compiled script:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_x64=TestFF.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

$pid = Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe","",@SW_MAXIMIZE)
MsgBox(0,"PID",$pid,5)

works for me. In script mode (x86 compatible) it does also. But in first try the Directives aren't set.

This worked! I see the #AutoIt3Wrapper_UseX64=y that Jos suggested above.  Seems that could have potentially been my problem.

Thank you everyone for the help, been working on this for about 3 hours now, glad to have it working.

-JimJam5x

Link to comment
Share on other sites

  • Developers

Just put in the line as I posted at the top. The SciTE4AutoIt3 helpfile is your friend for more details! ( F1 with the cursor on the directive)

The Run() syntax is wrong from the start! Again open the helpfile (f1 on run) to see what is wrong!

Quote

Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )

Parameters

program The full path of the program (EXE, BAT, COM, or PIF) to run (see remarks).
workingdir [optional] The working directory. Blank ("") uses the current working directory. This is not the path to the program.
show_flag [optional] The "show" flag of the executed program:
    @SW_HIDE = Hidden window (or Default keyword)
    @SW_MINIMIZE = Minimized window
    @SW_MAXIMIZE = Maximized window
opt_flag

[optional] Controls various options related to how the parent and child process interact.
    $STDIN_CHILD (0x1) = Provide a handle to the child's STDIN stream
    $STDOUT_CHILD (0x2) = Provide a handle to the child's STDOUT stream
    $STDERR_CHILD (0x4) = Provide a handle to the child's STDERR stream
    $STDERR_MERGED (0x8) = Provides the same handle for STDOUT and STDERR. Implies both $STDOUT_CHILD and $STDERR_CHILD.
    $STDIO_INHERIT_PARENT (0x10) = Provide the child with the parent's STDIO streams. This flag can not be combined with any other STDIO flag. This flag is only useful when the parent is compiled as a Console application.
    $RUN_CREATE_NEW_CONSOLE (0x10000) = The child console process should be created with it's own window instead of using the parent's window. This flag is only useful when the parent is compiled as a Console application.

Constants are defined in AutoItConstants.au3.

So the first example is missing the Workdir parameter and the last one is missing the full path in the first parameter.

EDIT: See you got it fixed .... also the parameters. ;)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

23 hours ago, JimJam5x said:

Return value? Didn't know I needed a return value since it works with iexplorer.  Beginner at all this by the way (first script that I have created) so that could be the problem.

I see you have it working, but I'll just comment:  You don't need a return value, or should I say, the Run command returns a value whether you use it or not.  But looking at the return value while you're debugging (for example in a message box or console write) can sometimes help you figure out why it isn't working.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...