Default directory using AutoIt.

2013-05-23
2013-05-23
  • Ryan Pollard

    Ryan Pollard - 2013-05-23

    Hi Guys,

    I have an issue with notepad++ which I just can't resolve. I would be thankful if you could help.

    I have compiled a .ini and .au3 file into a .exe, customsing all the the directories as to corresspond to Stata (a statistical programming app). In my command name which run's the .exe, shortcuts.xml contains "FULL_CURRENT_PATH" as seen here:

    <Command name="Stata: Do Current File" Ctrl="no" Alt="no" Shift="no" Key="120">

        &quot;C:\{your filepath}\SEND2STATA.KAK.EXE&quot; do &quot;$(FULL_CURRENT_PATH)&quot;</Command>
    

    <Command name="Stata: Include Current File" Ctrl="no" Alt="no" Shift="no" Key="120">

        &quot;C:\{your filepath}\SEND2STATA.KAK.EXE&quot; include &quot;$(FULL_CURRENT_PATH)&quot;</Command>
    

    <Command name="Stata: Run Current File" Ctrl="no" Alt="no" Shift="no" Key="120">

        &quot;C:\{your filepath}\SEND2STATA.KAK.EXE&quot; run &quot;$(FULL_CURRENT_PATH)&quot;</Command>
    

    <Command name="Stata: Run Selected Text" Ctrl="no" Alt="no" Shift="no" Key="119">

        &quot;C:\{your filepath}\RUNDOLINES.KAK.EXE&quot;</Command>
    

    <Command name="Stata: Help for selected text" Ctrl="yes" Alt="no" Shift="no" Key="119">

        &quot;C:\{your filepath}\HELPDOLINES.KAK.EXE&quot;</Command>
    

    I have edited {your filepath} to correspond with the location of the .exe (which lie in a folder in the desktop). The run command works well if I set the directory in Stata to the file which contains code, however, if I don't do this, Stata picks the C:\Program Files\Notepad++ to use as the directory, therefore it can't read in any files I may reference in my code. I would like Stata to pick up on the directory of my code file, and I believe the FULL_CURRENT_PATH should do this, but it just isn't working. Have you guys any ideas?

    All the best,

    ryan.

     
  • DV

    DV - 2013-05-23

    I'd do it in NppExec as one script:

    set PATH_0 = $(SYS.PATH) // save old %PATH%
    env_set PATH = C:{your filepath};$(SYS.PATH) // add path to Stata executables
    cd $(CURRENT_DIRECTORY) // directory of your current source file
    "SEND2STATA.KAK.EXE" do "$(FILE_NAME)"
    "SEND2STATA.KAK.EXE" include "$(FILE_NAME)"
    "SEND2STATA.KAK.EXE" run "$(FILE_NAME)"
    env_set PATH = $(PATH_0) // restore original %PATH%

     
    Last edit: DV 2013-05-23

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks