Constants - Path Macros

Top  Previous  Next

In MMB, there are fixed and dynamic paths:

Fixed path: complete drive + folder + file path that is static, pointing to one location.

For example: c:\My Wonderful Project\App\MyApp.exe

Fixed path downside is zero-adjustability of source folder by your end-user; he can't select where application will be installed, and that's not professional approach to end-users these days.

Dynamic path: in MMB path macros are being used to make easier locating of frequently used folders. While path macros read current path to your application, using them you assure end-user adjustability of installation folder.

Path macros in MMB are string (text) values and you will use them as a script command parameters. For example:

ScriptCommand("Param1","<ProjectFolder>\MyApp.exe")

Example above uses path macro called <ProjectFolder>\ to retrieve folder where your application is located. After path macro you write full file name (in this case: MyApp.exe).

Besides those available in MMB, there are additional path macros available in MMB PlugIns; refer to their documentation for more info on this subject.

Now, let's see what path macros we can use directly in MMB:

 

<SrcDir>

The most often used path macro, represents folder where your (running) application is located.

While other project files are usually also located there (or in subfolders), Source Directory (SrcDir) macro becomes common part of file-oriented commands in your project.

PathMacroSrcDir

If complete path to your application is:

c:\Program Files\My Project Folder\MyApp.exe

...then <SrcDir> version of this path would be:

<SrcDir>\MyApp.exe

It's much easier that way, isn't it ? For every file path inside your project's folder you will substitute fixed path with dynamic version and enjoy all benefits of self-adjusting paths !

Inside MMB script command, this path macro would look like this:

ScriptCommand("Param1","<SrcDir>\MyApp.exe")

Example above instructs script command to use <SrcDir>\ inside second parameter and locate application's source directory before looking for file (MyApp.exe).

 

Once MMB translates this path macro, it's again full path (for e.g. c:\Program Files\My Project\MyApp.exe) and script command can be run.

Notice: MMB runs project files in two modes:

Design Mode - while editing your project in MMB, using Project -> Run option will execute project internally, where <SrcDir> becomes MMB's installation folder (for example c:\Program Files\Multimedia Builder) and all files you refer to using <SrcDir> should be placed there.

This mode is enabled when Tools -> Designer Settings is set to internal player:DesignerSettingsBoxInternal

 

RunTime Mode - executes project either after compiling (File -> Compile) as stand-alone EXE file, or when Tools -> Designer Settings is set to specified external player:

DesignerSettingsBox

 

What is "external player" ? It's an instance of compiled (EXE) file placed in some folder (for e.g. D:\Source\Autorun.exe ). Once you refer to it in Tools -> Designer Settings (for e.g. D:\Source), <SrcDir> for projects you run in MMB editor becomes source folder of external player and all files you refer to using <SrcDir> should be placed there.

 

<SrcDrive>

Represents root folder of (source) drive your application is running on.

 

PathMacroSrcDrive

PathMacroSrcDrive2

 

If your application is located on C drive, <SrcDrive> path macro will return:

c:\

This macro is suitable for ROM-oriented media projects (run from CD-ROMs, DVDs) that must reach data folders starting from the root folder of media.

 

<CD>

Returns root folder of the first available CD drive.

 

PathMacroCD

If first available CD drive is placed on E letter, <CD> path macro will return:

E:\

This macro is also suitable for ROM-oriented media projects (run from CD-ROMs, DVDs) that must reach data folders starting from the root folder of media. Also works well for multimedia players for locating default Audio CD / DVD drive. Downside of this macro is - it cannot enumerate all drives, but only the first one.

 

<Embedded>

Returns folder used by your application for placing of embedded files.

 

 

PathMacroEmbed1

PathMacroEmbed2

As you can see on images above, locations of embedded folders are Window's folders for temporary files and they differ on Windows OS families.

For example. If you have embedded sound file:

MySound.wav

It's location with path macro will be:

<Embedded>\MySound.wav

When you run application, MMB will translate that path (for itself) either to:

c:\Windows\Temp\MMBPlayer\MySound.wav (for Windows 9x OS family)

...or to something like:

c:\Documents and Settings\UserName\Local Settings\Temp\MMBPlayer\MySound.wav (for Windows NT OS family, where folders for temporary files are individual for users)

 

<Windows>

Returns Windows root folder.

 

PathMacroWindows

For example, if Windows is installed on the C drive and you want to find win.ini file, location with path macro will look like this:

<Windows>\win.ini

When you run application, MMB will translate that path (for itself) to:

C:\Windows\win.ini

In MMB, <Windows> path macro is usually called to locate system INI files.

 

<System>

Returns Windows System folder.

PathMacroSystem1

PathMacroSystem2

If you're trying to locate program:

dxdiag.exe

It's location with path macro will be:

<System>\dxdiag.exe

When you run application, MMB will translate that path (for itself) either to:

c:\Windows\System\dxdiag.exe (for Windows 9x OS family)

...or to something like:

c:\Windows\System32\dxdiag.exe (for Windows NT OS family)

 

<Temp>

Returns Windows Temp folder used for placing of Windows temporary files.

 

 

 

PathMacroTemp1

PathMacroTemp2

If you have some temporary file:

TempList.txt

It's location with path macro will be:

<Temp>\TempList.txt

When you run application, MMB will translate that path (for itself) either to:

c:\Windows\Temp\TempList.txt (for Windows 9x OS family)

...or to something like:

c:\Documents and Settings\UserName\Local Settings\Temp\TempList.txt (for Windows NT OS family, where folders for temporary files are individual for users)

<File>

Returns full path & name of file opened using MMB's Open File dialogbox.

 

PathMacroFile

If you open file:

c:\windows\regedit.exe

that path can be retrieved later by simply pointing to:

<File>

Content of this path macro is changed every time user selects & opens file, so it's recommended to use string variables or arrays for multiple path storage.

 

<List>

Enables operations specific to MMB's internal play list and ListBox object.

 

PathMacroList

 

<List> constant holds items present in MMB's Internal Song List, so you can easily transfer all it's items to MMB's ListBox Object.

Script example:

ListBoxAddItem("SongList","<List>")

In real-code example above, content of <List> will be transfered to ListBox object labeled "SongList" . For more info on ListBoxAddItem command, refer to ListBox Commands section.

<This>

<This> is a special macro useful only in MCI command. It will tell the device the MMB window will be the parent.

Here is a small sample how to play MPG movie inside the mbd project in the position (100,50,100,100):

MCICommand ("open <SrcDir>\sample.mpg alias MPEG style child parent <This>")

MCICommand ("put MPEG window at 100 50 200 200")

MCICommand ("window MPEG state hide")

MCICommand ("play MPEG")