It's able to tell me if file exists or not. But when it tries to launch it won't open the folder. I think it has to do something with the syntax of the asterisk.
Code: Select all
;NEW TEST FOR TEMPLATE
!z::
inputbox, userinput, Create New Project Template, Please Enter Full Project ID of the new project you wish to create, ,300 ,140
;If the user pressed cancel or the string is too short
if (ErrorLevel || StrLen(userinput) < 15)
{
msgbox, , Project ID too Short, Please enter full project ID with the correct format.
return
}
ifexist % "I:\My Drive\Webcam\Webcam - Projects\" SubStr(userinput, 1, 4) "\" SubStr(userinput, 1, 15) "*", D
{
msgbox, 16, Overwrite Protection Safety, This Folder Already exists, cannot overwrite files or folders. Opening File directory instead
Run, % "I:\My Drive\Webcam\Webcam - Projects\" SubStr(userinput, 1, 4) "\" SubStr(userinput, 1, 15) "*", D
}
else
msgbox, file does not exists
return
Code: Select all
!a::
inputbox, userinput, Enter Full Project ID, , ,300 ,100
; If the user pressed cancel or the string is too short
if (ErrorLevel || StrLen(userinput) = 0)
return
FoundFile := ""
Loop, Files, % "I:\My Drive\Webcam\Webcam - Projects\" SubStr(userinput, 1, 4) "\" SubStr(userinput, 1, 15) "*", D
{
FoundFile := A_LoopFileFullPath
break
}
if (FoundFile != "")
Run, % FoundFile
Else
IfExist, % "I:\My Drive\Webcam\Webcam - Projects\" SubStr(userinput, 1, 4) "\"
{
MsgBox, 64,Folder Not Found, % "Folder Name was not found. Opening Territory Folder instead (" SubStr(userinput, 1, 4) ")"
Run, % "I:\My Drive\Webcam\Webcam - Projects\" SubStr(userinput, 1, 4) "\"
}
else
{
msgbox, 16,Folder Not Found, % "Territory Code (" SubStr(userinput, 1, 4) ") Does not Exist. Opening Webcam Projects Folder instead"
Run, I:\My Drive\Webcam\Webcam - Projects\%no%\, , UseErrorLevel
}
Return