James Posted May 20, 2007 Share Posted May 20, 2007 Hey, 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.") Else ShellExecuteWait($Readme, @DesktopDir, @SW_MAXIMIZE) EndIf EndFunc ;==>_RunProg James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 20, 2007 Share Posted May 20, 2007 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) EndFuncIf 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 Link to comment Share on other sites More sharing options...
James Posted May 21, 2007 Author Share Posted May 21, 2007 I forgot to mention I made the same script on my own. Just didnt realise another person has done it. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now