Jump to content

Vars and Run


Recommended Posts

Why won't this work? It won't run the file - giving me "Unable to execute the external program." If I specify in the file what the location and name is in Run(here), then it works. However, it gives that error when I do it using the below method.

$nextItemProgram = _GUICtrlListViewGetItemText($ListView1, $nextItem, 5)
GUICtrlSetData($Status, "Program " & $nextItemName & " Ran   "& $nextItemProgram)
Dim $szDrive, $szDir, $szFName, $szExt  ;<--- straight from the help file
$TestPath = _PathSplit($nextItemProgram, $szDrive, $szDir, $szFName, $szExt) ;<--- straight from the help file
Run($nextItemProgram,$szDrive&$TestPath[2])

Edit: corrected syntax

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

Try this:

$nextItemProgram = _GUICtrlListViewGetItemText($ListView1, $nextItem, 5)
GUICtrlSetData($Status, "Program " & $nextItemName & " Ran   "& $nextItemProgram)
Dim $szDrive, $szDir, $szFName, $szExt  ;<--- straight from the help file
$TestPath = _PathSplit($nextItemProgram, $szDrive, $szDir, $szFName, $szExt) ;<--- straight from the help file
MsgBox(0,'', $nextItemProgram & @LF & $szDrive & @LF & $TestPath[2])

Maybe what's being passed to Run() is not what you're expecting.

*Edit: Also uh, you know that the 3rd parameter for run (where you're passing $szDrive&$TestPath[2]) is the window flag. It takes a value like @SW_HIDE, @SW_MAXIMIZE, or @SW_MINIMIZE.

*Edit of edit: You edited your post and corrected the very thing I pointed out in this edit. So ignore this.

Edited by Saunders
Link to comment
Share on other sites

By th ecorrect information do you mean correct to use in your script as you have shown?

I would expect that you would need to add ':\' to the drive, '\', to the path and '.' before the extension. (But I haven't looked to see what Drive Split returns.)

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The name file I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exe

this works

Run('"I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exe"','I:\SAI\Auto-It files\')oÝ÷ ÚØb±Ú²z-jëh×6Run($nextItemProgram,'I:\SAI\Auto-It files\')
A decision is a powerful thing
Link to comment
Share on other sites

This is the problem - $nextItemProgram = '"I:\SAI\Auto-It files\Internet Log Transfers - 10am - (M).exe"'

It is a valid file name and path

This works - $nextItemProgram = '"I:\SAI\Auto-It files\MA Run.exe"'

Does it have something to do with the (M)

A decision is a powerful thing
Link to comment
Share on other sites

Ok, I'm an idiot! I didn't think that there could be a problem with the exe haha. I thought I was just scripting wrong!

:duh:

:whistle: thanks guys!

I corrected the problem inside Internet Log Transfers - 10am - (M).exe and it works fine now. Miss one thing during diagnosis and you'll be scratching your head forever :P

A decision is a powerful thing
Link to comment
Share on other sites

Good call Valuater! I use that method a lot and it works wonders. I've never used the shortname part. Why that little added bit? Is that incase you're on an older OS or one that limits chars?

No sometimes it helps with spaces in the file name/location for me

I guess I needed

_DoesTheExeWorkYouDork()

:P

LOL... :whistle:

8)

NEWHeader1.png

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