my script is asking the user to select a file to run by this
FileSelectFile, Var_FileRun
Then later on in the script i run the file like this
run, %Var_FileRun%
However this make the file run in the A_workdir and i need it to run from it location folder.
Is there a way to make the run command always start the file in it own folder. or a simple way to trim the Var_FileRun to only contain the folder location of the file
E.g.:
Var_FolderRun := FunctionTrim(Var_FileRun)
Getting folderpath from filepath. ( or run exe in its own folder) Topic is solved
Re: Getting folderpath from filepath. ( or run exe in its own folder) Topic is solved
figured it out. posting incase other is going to need it
Var_FolderRun := SubStr(Var_FileRun, 1, InStr(Var_FileRun, "\", , Startingpos := 0))
It usses InStr to find the locationg of the lats \ in the path
that is then passed on to SubStr as the lengs of the string of the path to put into Var_FolderRun
Var_FolderRun := SubStr(Var_FileRun, 1, InStr(Var_FileRun, "\", , Startingpos := 0))
It usses InStr to find the locationg of the lats \ in the path
that is then passed on to SubStr as the lengs of the string of the path to put into Var_FolderRun
- JoeWinograd
- Posts: 2198
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Getting folderpath from filepath. ( or run exe in its own folder)
Since your FileSelectFile,Var_FileRun command has no params beyond the OutputVar, Var_FileRun will contain the full file path, as stated in the FileSelectFile doc. If you want to split Var_FileRun into its components, read the SplitPath doc, which shows that you can do this:
SplitPath,Var_FileRun,OutFileName,OutDir,OutExt,OutNameNoExt,OutDrive
Regards, Joe
SplitPath,Var_FileRun,OutFileName,OutDir,OutExt,OutNameNoExt,OutDrive
Regards, Joe