Announcement

Collapse
No announcement yet.

Get the Path location of the application

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

  • Get the Path location of the application

    Hi, i have this function save before but cannot find it anymore.. can anyone share/help me how to get the specific file location of my autorun.exe?

    example on show dialog will display "C:\\MyProject\autorun.exe"

    report will change if the file is move to another locations..


    Thanks

  • #2
    maybe this -

    Code:
    --[[the SFXSOURCE argument is always the last table item so you can access it with Table.Count
    heres what i use
    --Place in Globals
    --the SFXSOURCE argument is always the last table item so you can access it with Table.Count]]
    function EXESourceFolder()
    if _CommandLineArgs[Table.Count(_CommandLineArgs)] then
    if String.Left(_CommandLineArgs[Table.Count(_CommandLineArgs)], 3) == "SFX" then
    local strPath = String.Replace(_CommandLineArgs[Table.Count(_CommandLineArgs)], "SFXSOURCE:", "", true)
    strPath = String.SplitPath(strPath)
    return strPath.Drive..strPath.Folder
    end
    end
    end
    
    -- usage
    Source=EXESourceFolder()
    if Source == "" then
    Source=_SourceFolder
    end
    Cheers

    Comment


    • #3
      here's a demo
      sfx.zip

      Comment


      • #4
        Hi colc, i tried this and it works also
        path = _SourceFolder.."\".._SourceFilename;

        Comment


        • #5
          i will check also you example. thank you so much...

          Comment


          • #6
            colc im thinking about replacing my main exe while it is open it is posible?
            im in my mind is example if my application is running an performing a download of the updated exe, now when its done i will extract the downloaded file and update the exe by replacing it from the downloaded one.. is it possible? restart the app then replace then reopen by code?

            Comment


            • #7
              Use my GlobalPaths plugin. The global variable which stores that value is _ExeFolder.
              https://github.com/CentauriSoldier

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎