Jump to content
Macro Express Forums

getting current directory


Recommended Posts

I am giri @ girija prasad,

I have a need to read files where the mex file is located i.e. if xyz.mex file is located at c:\providerextract\, there are some other files test.txt(text file) provider.xls (excel file) at that location which I need to read. suppose if i change xyz.mex file to another location d:\demo\xyz.mex, then I have a need to read test.txt, provider.xls from the location. I also need to run macro express pro from command line with mex file/nickname.

 

I tried to run MacroExpressPro MeProc.exe /A::c:\TestMacros.mex?TestMacro but I got the errors and could not run. or else atleast In another way I have to findout the current directory. .

thanks in advance

giri

Link to comment
Share on other sites

I have a need to read files where the mex file is located

Try this:

Variable Set From Misc:  "Current Macro File" into %MacroFilePath%
Variable Set From File path
Text Box Display: Result

<VARIABLE SET FROM MISC Destination="%MacroFilePath%" Value="Current Macro File"/>
<VARIABLE SET FROM FILE Filename="%MacroFilePath%" Option="\x01" Drive="%Drive%" Path="%Path%" Expand="FALSE" Flags="\x03"/>
<TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %MacroFilePath%\r\n\\par %Drive%%Path%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="866" Height="118" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

Link to comment
Share on other sites

This is how I normally do it:

Variable Set From Misc:  "Current Macro File" into %Macro File Path%
Variable Set From File path
Variable Set String %Macro File Path% to "%Macro File Drive%%Macro File Path%"

<VARIABLE SET FROM MISC Destination="%Macro File Path%" Value="Current Macro File"/>
<VARIABLE SET FROM FILE Filename="%Macro File Path%" Option="\x01" Drive="%Macro File Drive%" Path="%Macro File Path%" Name="%Macro File Name%" Extension="%Macro File Ext%" Expand="FALSE" Flags="\x03"/>
<VARIABLE SET STRING Option="\x00" Destination="%Macro File Path%" Value="%Macro File Drive%%Macro File Path%"/>

As I have explained in other posts here I create macro packages this way. One folder of the MEX and all the support files. Works well to create development packages as well.

Link to comment
Share on other sites

This is how I normally do it:

Variable Set From Misc:  "Current Macro File" into %Macro File Path%
Variable Set From File path
Variable Set String %Macro File Path% to "%Macro File Drive%%Macro File Path%"

<VARIABLE SET FROM MISC Destination="%Macro File Path%" Value="Current Macro File"/>
<VARIABLE SET FROM FILE Filename="%Macro File Path%" Option="\x01" Drive="%Macro File Drive%" Path="%Macro File Path%" Name="%Macro File Name%" Extension="%Macro File Ext%" Expand="FALSE" Flags="\x03"/>
<VARIABLE SET STRING Option="\x00" Destination="%Macro File Path%" Value="%Macro File Drive%%Macro File Path%"/>

As I have explained in other posts here I create macro packages this way. One folder of the MEX and all the support files. Works well to create development packages as well.

thanks & I will apply this to my program

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...