PDA

View Full Version : File.run problem


Dan Ullman
09-05-2006, 06:22 PM
I use the following Code:


Productkey_result = File.Run(_TempLaunchFolder.."\\add-on.bat", "", "", SW_SHOWNORMAL, true);



When this code is ran I get the following as the batch file runs:

D:\>Productkey AIS xxxxxxxxxxxxxxx /q

'Productkey' is not recognized as an internal or ....."

D: in this case is the CD rom. Three files, hasp.exe, add-on.bat and productkey.exe are all installed a primer files. Hasp.exe runs without a problem. Add-on.bat wants to run from the CD rather then the (_TempLaunchFolder .

This is what the actual command looks like in the batch file:


ProductKey AIS t1nvtpj1ttivvjci /q


Any clues?

Adam
09-06-2006, 10:40 AM
I would add this to the code:


FileHome = File.DoesExist(_TempLaunchFolder.."\\add-on.bat");
if FileHome then
Dialog.Message("","The file exists in the proper location");
else
Dialog.Message("","The file exists in the proper location");
end


This will let you know if Setup Factory is recognizing the file or not. Also check out the temp folder manually and see if that file makes and appearance.

Adam Kapilik

Dan Ullman
09-07-2006, 12:17 PM
Add-on.bat was there and found. Turns out the problem is with the help files.

From the help file:
WorkingFolder
(string) The working folder to set for the executable file.
Note: This sets the current directory for the operation to something other than the folder that the file is in (em added) . Normally, you can just leave it blank.

This suggests that the working or current directory is, in my case, the temp install folder and that WorkingFolder does not need to be set. However, the working folder remains the CD drive which is why productkey was not found when add-on.bat was ran. File.Run just uses the path given to run the file. If another file is also needed File.run must be specificly told where that file is or it assumes the file is in the _SourceFolder.



The problem was solved by adding "SessionVar.Expand("%TempLaunchFolder%")" as the working folder. Oddly enough, "_TempLaunchFolder.." returns an error if you try to use it in the WorkingFolder position.