Original EXE Path (not the TEMP run-path)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6125

    Original EXE Path (not the TEMP run-path)

    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!

    Code:
    [color=#006600]--[[ 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!
    ]][/color]
    
    function fnEXEOrigLoca(runexe)
    	resFile = File.Run(runexe, "", "", SW_SHOWNORMAL, false)
    	
    	strCWF = Folder.GetCurrent()
    		strPath = String.Replace(_CommandLineArgs[1], "SFXSOURCE:", "", true)
    			return strPath;
    end
    
    [color=#006600]-- An example "function call" (to use the function)[/color]
    fnEXEOrigLoca(_DesktopFolder.."\\app_name.exe")
    
        [color=#006600]-- This Message box can be removed (it's just for visual feedback)[/color]
    	Dialog.Message("", strPath)
    Intrigued
  • Eagle
    Indigo Rose Customer
    • Mar 2005
    • 944

    #2
    This will do the trick if you pass commands to the SFX at runtime:


    Code:
    -- 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.SplitPath(strSFXmid).Folder;
    		Dialog.Message("Debug Only Notice", strSFXApPath);
    		end
    	end
    When passing commands the 'SFXSOURCE:' is the last in
    the _CommandLineArgs table.

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6125

      #3
      Originally posted by Eagle
      This will do the trick if you pass commands to the SFX at runtime:


      Code:
      -- 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.SplitPath(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

      Intrigued

      Comment

      Working...
      X