Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

Original EXE Path (not the TEMP run-path)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:
    --[[ 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)
    Intrigued

  • #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


    • #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