Jump to content
Sign in to follow this  

Error on folders

Recommended Posts



For part of my program I am allowing people to run programs from a desktop. If the program is a .exe then it will run, if its a folder it doesnt work.

I have tried If @error then MsgBox() but it doesnt work.

Here is what I have so far.

Func _RunProg()
    $Readme = _GUICtrlListViewGetItemText($mList, _GUICtrlListViewGetSelectedIndices($mList))
    $mList = _GUICtrlListViewGetItemText($mList, 0)
    ; If $mList = "My Computer" Then MsgBox(0, "File Run", "Found My Computer")
    If PathIsDir($mList) Then
        MsgBox(0x10, "Error", "You cannot run a folder.")
    ShellExecuteWait($Readme, @DesktopDir, @SW_MAXIMIZE)
EndFunc   ;==>_RunProg


Share this post

Link to post
Share on other sites

PathIsDir() is not a built-in AutoIt function. You didn't include Manadar's little UDF:

Func PathIsDir($s_Path) ; if the path entered is a directory, it returns a number bigger then zero. If it is not it returns 0.
    $s_Attrib = FileGetAttrib($s_Path)
    Return StringInStr($s_Attrib,"D",1)

If it was actually included elsewhere, your script fragment looks like it should work. If you still have a problem, use a debug MsgBox() or ConsoleWrite() to make sure $mList really has the path in it.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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