Sign in to follow this  
Followers 0
Guest kbryant2

Runas script error

5 posts in this topic

got a error testing the script before compiling. Is it the gear511.exe file it can not find or something else?:

Line 13 (file "c:\documents and settings\kbryant2\my documents\runsoftwareasadmin.au3"):

$val=runwait($runprogram, $runpath, @sw_maximize

Error: unable to execute external program.

the system can not find the specified file.

Text of au3 script file executed:

--------------------------------------------------------------------------------

Dim $UserName, $DomainName, $Password, $RunProgram, $RunPath

$UserName = "administrator"

$DomainName = "unit-02"

$Password = "*********"

$RunProgram = "Gear511.exe"

$RunPath = "C:\Program Files\NETGEAR\WG511SCU\Utility"

RunAsSet ( $UserName, $DomainName, $Password )

$val = RunWait($RunProgram, $RunPath, @SW_MAXIMIZE)

--------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

In your code, $RunProgram must contain the full path of the exe unless it is being run from the same directory as the script was executed from. You can't just set the working path and expect it to find your exe without telling it where to look.

[Edit]: Programs that are in your %PATH% would be the exception to this rule. I believe you can run these from anywhere with the Run or RunWait functions.

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

:D Thanks that worked. After compiling I put the exe in the all users startup folder. Interestingly I get 2 gear511.exe processes running unless I logon with the admin account used in the script runas command.

Does autoit have the ability to close a application in the systray?

Kenny

Share this post


Link to post
Share on other sites

Does autoit have the ability to close a application in the systray?

Yes, but it's always better to close an application by another way if possable. If you can send a switch to the program you wish to close, or detect it's hidden window, you should close it this way.

You can use the PixelChecksum function to find a specific image. It gets more complicated if the tray hides inactive icons, because excatally where you have to click to open the tray fully changes as icons are hidden. With a little bit of playing around you should be able to detect a small part of the image you wish to click on, and then close it from the context menu.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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