Jump to content

2 easy (but not answered)


Guest Beefteck
 Share

Recommended Posts

Guest Beefteck

Ok well i am whipping something up for a site and found here that... well I am having problems again with running another type of .exe...

Here is what I have for questions:

1) How do i run a .exe file from a script (compiled or not) that is in a sub folder (i.e. ...>Parent (script in this)>Data>More Data\Setup.exe)

2) How would I make a simple custom error message, one that if any type of error ocurred like file not found etc i could have a msg be made instead of the autoit one.

Thank-you so much for your time in even reading this.

-Beefteck :whistle:

Link to comment
Share on other sites

  • Moderators

$hFile = 'FileLocation\FileName.Extension'
If FileExists($hFile) Then
    ShellExecute($hFile)
Else
    MsgBox(16, 'Error', 'File does not exist.')
EndIf

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest Beefteck

nice, ok now i just really need help with the .exe run in a sub-folder.... =( plz help this is my biggest issue here...

-Beefteck

Link to comment
Share on other sites

  • Moderators

nice, ok now i just really need help with the .exe run in a sub-folder.... =( plz help this is my biggest issue here...

-Beefteck

I or anyone would help if we had a clue what you were talking about.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The answer to your main problem is

$hFile = 'FileLocation\FileName.Extension'
If FileExists($hFile) Then
    ShellExecute($hFile)
Else
    MsgBox(16, 'Error', 'File does not exist.')
EndIf

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

Guest Beefteck

lol :whistle:

ok well I am running a script in a first folder, 3 sub folders in is a setup.exe file that for some reason will not allow me to run it from my script (compiled or not)

Break down of folders with files

Folder A: Script

>Folder B: Data

>>Folder C: Setup.exe

so here is my run that won't work

Run (@ScriptDir & "\Data\MSWorks\Setup.exe")

I get this error:

Error: Unable to execute the external program.

The request operation requires elevation.

Any ideas?

Link to comment
Share on other sites

"requires elevation" sounds like you've got permission / security issues totally unrelated to the nature of your posed question.

You may need to investigate the wonderful vagaries of RunAs()

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

  • Moderators

1. In what I gave you, do you see "Run" anywhere?

So now you have introduced a problem you have, that you never iterated you had to begin with... see an issue with this?

If you run this in an .au3 file by itself, do you get the msgbox?

If FileExists(@ScriptDir & "\Data\MSWorks\Setup.exe") = 0 Then MsgBox(64, 'Info', @ScriptDir & "\Data\MSWorks\Setup.exe" & @CRLF & 'Does Not exist.')oÝ÷ Øò¢çhm¶§¶©jØb±Ê+­ç-N§­êeiǦÉ(^Q1yË­{­«­¢+ÙIÕ¸ ÌäìÅÕ½ÐìÌäìµÀìMÉ¥ÁѥȵÀìÌäìÀäÈíÑÀäÈí5M]½É­ÌÀäÈíMÑÕÀ¹áÅÕ½ÐìÌäì
and see if that works Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest Beefteck

well now i know why it never worked (i had to run as an admin cause i am using vista)....

also SmOke_N that second code you gave me works like a charm thanks so much and i am testing out that 1st one in ur last post too. thanks evey1

-beefteck

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...