Sign in to follow this  
Followers 0
infoteklink

unable to execute the external program

15 posts in this topic

Ok, I've written scripts using autoit many times. Although they have been pretty basic scripts, I understand how it works. All I want the latest script I'm writing to do is open up the services.msc in the system 32 folder in xp pro. Here is what I have:

Opt("MouseCoordMode", 0)

Run ("C:\WINDOWS\system32\services.msc")

I keep getting the following "error: Unable to execute the external program"

I can go to the system32 folder and double click on the services.msc and it will open, but the script will not. Any ideas on how to make it open?

Thanks

Share this post


Link to post
Share on other sites



Oh and by the way I just realized that the .msc will not work with the run command because it is not an .exe, .bat, .com, or .pdf format. So what command or workaround do I use to run the .msc?

Share this post


Link to post
Share on other sites

This is the best way:

Run("mmc services.msc", @SystemDir)

Share this post


Link to post
Share on other sites

Hi

You can only run (EXE, BAT, COM, or PIF), but not .msc

Try that:

$File = @SystemDir & "\services.msc"
Run(@SystemDir & "\mmc.exe " & $File)

Sorry, which my English is so bad. I come from Switzerland ;-)

Share this post


Link to post
Share on other sites

run(@comspec & ' /c ' & @systemdir & '\services.msc', '', SW_HIDE)

This should work.

Share this post


Link to post
Share on other sites

Oh and by the way I just realized that the .msc will not work with the run command because it is not an .exe, .bat, .com, or .pdf format.  So what command or workaround do I use to run the .msc?

<{POST_SNAPBACK}>

Thanks Slim, it worked like a charm. I just learned something.

Much appreciated!

Share this post


Link to post
Share on other sites

Another question. How can you start and stop services using autoit. I want to be able to start and stop the "Wireless Zero Configuration" at different times. How do it do that with the script?

Thanks

Share this post


Link to post
Share on other sites

Another question.  How can you start and stop services using autoit.  I want to be able to start and stop the "Wireless Zero Configuration" at different times.  How do it do that with the script?

Thanks

<{POST_SNAPBACK}>

- Or - do an old fashion "Net Start/Stop" command with runwait.

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

Share this post


Link to post
Share on other sites

- Or - do an old fashion  "Net Start/Stop" command with runwait.

<{POST_SNAPBACK}>

Sweet! It worked like a charm. The command I used is as follows:

RunWait(@ComSpec & " /C " & "net start wzcsvc")

Thanks JdeB!

Share this post


Link to post
Share on other sites

Thanks Slim, it worked like a charm.  I just learned something.

Much appreciated!

<{POST_SNAPBACK}>

I am new to scripting and saw from the posts what the problem is but am unsure how to solve it. I have converted a script using autoit and it should open a windows media player playlist and a photo album. I get an error when the converted script trys to open the playlist (.wpl) file. The script I created works fine. Does anyone know how to get this program to open the playlist? Here is what I have so far:

call "C:\Documents and Settings\mike admin\My Documents\newdvd\test.wpl" | call "d:\Ezphoto\EZPHOTO.EXE"

thanks in advance

mike

Share this post


Link to post
Share on other sites

I am new to scripting and saw from the posts what the problem is but am unsure how to solve it. I have converted a script using autoit and it should open a windows media player playlist and a photo album. I get an error when the converted script trys to open the playlist (.wpl) file. The script I created works fine. Does anyone know how to get this program to open the playlist? Here is what I have so far:

call "C:\Documents and Settings\mike admin\My Documents\newdvd\test.wpl" | call "d:\Ezphoto\EZPHOTO.EXE"

thanks in advance

mike

<{POST_SNAPBACK}>

you could try:

Run(@comspec & ' /c Start "C:\Documents and Settings\mike admin\My Documents\newdvd\test.wpl"')

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

Share this post


Link to post
Share on other sites

you could try:

Run(@comspec & ' /c Start "C:\Documents and Settings\mike admin\My Documents\newdvd\test.wpl"')

<{POST_SNAPBACK}>

this opens a cmd window and puts me in the newdvd dir where I can type test.wpl and it works. I tried adding @ehco test.wpl. I think this is a start. I still welcome any other tips and help. thanks JdeB

Share this post


Link to post
Share on other sites

this opens a cmd window and puts me in the newdvd dir where I can type test.wpl and it works. I tried adding @ehco test.wpl. I think this is a start. I still welcome any other tips and help. thanks JdeB

<{POST_SNAPBACK}>

do you have your program associated with the WPL extension ? (in other words ...when you double click it in windows explorer, does it open with the correct program?)

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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

do you have your program associated with the WPL extension ? (in other words ...when you double click it in windows explorer, does it open with the correct program?)

<{POST_SNAPBACK}>

Yes it opens fine. .WPL is a windows media player playlist.

Also, when I try to run a .bat file everything works fine but I can't use sendkeys from dos (as far as I know). This is what brings me to autoit.

I have gtten autoit to en the 2 programs and send desired keys, but 1 problems exists:

1) The window I send keys to is not always on top and I am not sure if I have the usage os @SW_SHOW to bring the right window to the front. could someone check this to make sure it loks good?

Here is what I have so far:

Run("C:\Program Files\Windows Media Player\wmplayer.exe", "")

Sleep ( 6000 )

WinSetState ("Windows Media Player","",@SW_SHOW)

send("!f")

sleep ( 1000 )

send("o")

sleep ( 1000 )

send("d:\test.wpl")

sleep ( 2000 )

send("{ENTER}")

sleep ( 1000 )

Run("D:\Ezphoto\EZPHOTO.EXE", "")

Sleep ( 6000 )

WinSetState ("slideshow8","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 150 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow6","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 4745000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow5","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 4580000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow4","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 2330000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow3","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 4910000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow2","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 4785000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

WinSetState ("slideshow1","",@SW_SHOW)

sleep ( 1000 )

send("!f")

sleep ( 1000 )

send("p")

sleep ( 5000 )

For $i = 4590000 to 1 Step -5

sleep ( 5000 )

send("{RIGHT}")

Next

send("{ESC}")

;close all windows opened by program

exit

thanks for your help once again.

Edited by lemacks

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