PDA

View Full Version : Original EXE Path (not the TEMP run-path)



Intrigued
05-04-2005, 09:57 PM
Note from author: This function will allow you to code into your application a way to get the path to where the AMS 5 created application (aka. executable, .exe) is located. Do not confuse this with the "temp" (aka. temporary) run-from (as I call it) location!


--[[ NOTE: This function only works AFTER you Build (F7) the project!

The following function takes one argument (runexe = path and name of .exe)...
and returns one string (strPath = the path of...
the location of the .exe), NOT the temp ran-from location!
]]

function fnEXEOrigLoca(runexe)
resFile = File.Run(runexe, "", "", SW_SHOWNORMAL, false)

strCWF = Folder.GetCurrent()
strPath = String.Replace(_CommandLineArgs[1], "SFXSOURCE:", "", true)
return strPath;
end

-- An example "function call" (to use the function)
fnEXEOrigLoca(_DesktopFolder.."\\app_name.exe")

-- This Message box can be removed (it's just for visual feedback)
Dialog.Message("", strPath)

Eagle
05-20-2005, 06:22 AM
This will do the trick if you pass commands to the SFX at runtime:



-- MySFXApp full folder path
local ncnt = Table.Count(_CommandLineArgs);
for n, cmline in _CommandLineArgs do
if (n == ncnt) then
strSFXmid = String.Mid(_CommandLineArgs[n], 11, -1); -- return string to right of SFXSOURCE:
strSFXApPath = String.SplitPath(strSFXmid).Drive..String.SplitPat h(strSFXmid).Folder;
Dialog.Message("Debug Only Notice", strSFXApPath);
end
end

When passing commands the 'SFXSOURCE:' is the last in
the _CommandLineArgs table.

Intrigued
05-30-2005, 10:17 PM
This will do the trick if you pass commands to the SFX at runtime:



-- MySFXApp full folder path
local ncnt = Table.Count(_CommandLineArgs);
for n, cmline in _CommandLineArgs do
if (n == ncnt) then
strSFXmid = String.Mid(_CommandLineArgs[n], 11, -1); -- return string to right of SFXSOURCE:
strSFXApPath = String.SplitPath(strSFXmid).Drive..String.SplitPat h(strSFXmid).Folder;
Dialog.Message("Debug Only Notice", strSFXApPath);
end
end

When passing commands the 'SFXSOURCE:' is the last in
the _CommandLineArgs table.

Alright then!

:yes

;)