Program Not Running, wrong Syntax?
Posted: 22 May 2019, 11:57
Hi, I'm developing a code that will create a new directory, and templates. On an already existing Large database. But I I need it to check if folder already exists, to cancel the program. And I would like it to open the folder if it does exist.
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.
I had a script before that I got help with that found directory even if last characters didn't match 100%. This script works perfect, I've been using it as a reference and it has the same directory syntax, so not sure what is my first code having problem opening the folder.
Any help or ideas, much appreciated. Thank you!
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