» Welcome Guest
[ Log In :: Register ]

 

[ Track this topic :: Email this topic :: Print this topic ]

Topic: Execute a macro from the command, specifying param< Next Oldest | Next Newest >
Guest
Unregistered





Posted: July 17 2005,22:07

Hello,
my Name is Thomas and I'm from Germany - sorry for my broken english...

I want to start a macro form the command line. The macro was recorded before and safed.
To start the macro from the command line works well. But the additional macro-parameters in the
the command line have been ignored.

In the help-file is the folowing example:
mp3tag_s.exe -ds "c:\My Mp3 Folder" -macro "My Macro" -macroparam MyParam1 "Some value 1" -macroparam MyParam2 "Some value 2"


:confused: Now my try:
mp3tag_s.exe -ds "C:\MyMp3Album" - macro "MyMacro" -macroparam AlbumString "TheNameOfTheAlbum"

The macro will be executed but the Parameter will be ignored...

:confused: I have also tried:
mp3tag_s.exe -ds "C:\MyMp3Album" - macro "MyMacro" -macroparam SetAlbum "TRUE" -macroparam AlbumString "TheNameOfTheAlbum"

...the same


The macro-file contains the following lines:
MacroFileVersion=3506
[MassSetTags]
SetTitle=FALSE
TitleString=
TitleMode=2
SetArtist=FALSE
ArtistString=
ArtistMode=2
SetAlbum=TRUE
AlbumString=
AlbumMode=2
SetTrackNr=FALSE
TrackNrString=
SetYear=TRUE
YearString=
YearMode=2
SetComment=FALSE
CommentString=
CommentMode=2
SetGenre=FALSE
GenreString=
SetPrivateFlag=FALSE
PrivateFlagValue=FALSE
SetCopyrightFlag=FALSE
CopyrightFlagValue=FALSE
SetOriginalFlag=FALSE
OriginalFlagValue=FALSE
OnlySetFlagsInHeader=TRUE


-------------------------------------------------------
Thanks for your answers!

Thomas
Back to top
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: July 17 2005,22:33

You cannot set macro property values like that, you must define your parameters specifically in the macro file. This is an excerpt from the Mp3/Tag Studio help file, which can be found in the "Macros" section of the help file, under the "Advanced macro capabilities" sub section:

Quote
Macro parameters

For advanced users, there is a possibility to use variable parameter values for any recorded macro.

All macros are saved as separate files in the subfolder "Macros" of the Mp3/Tag Studio installation directory, having the file extension ".mtm". These files are normal text files, and you can open them in e.g. Notepad.

As you will see, all the recorded operations of a macro will be saved inside these files in the following way:

---------------------------------------------------------

[MacroOperationName]
MacroOperationParameterName1=MacroOperationParameterValue1
MacroOperationParameterName2=MacroOperationParameterValue2
...
{MacroOperationSubsectionName}
MacroOperationSubsectionParameterName1=MacroOperationSubsectionParameterValue1
MacroOperationSubsectionParameterName2=MacroOperationSubsectionParameterValue2
...

---------------------------------------------------------

To make the macros more flexible, you can specify that some (parts of) values should be dynamic, and entered by the user each time the macro is executed. This is exactly what the macro parameters are used for.

Using the example above as a reference, here is an example of how you define and use macro parameters:

---------------------------------------------------------

param %MyParam1% : string = <Artist>
param %MyParam2% : integer = 25
[MacroOperationName]
MacroOperationParameterName1=%MyParam2%
MacroOperationParameterName2=%MyParam1% - <Title>.mp3
...
{MacroOperationSubsectionName}
MacroOperationSubsectionParameterName1=MacroOperationSubsectionParameterValue1
MacroOperationSubsectionParameterName2=MacroOperationSubsectionParameterValue2
...

---------------------------------------------------------

As you can see above, macro parameter definitions have the following format:

param %ParameterName% [: ParameterType] [= DefaultValue]

Each parameter definition line begins with the word "param", followed by a variable name enclosed in percentage signs (the percentage signs are mandatory). Except for the enclosing percentage signs, a variable name can only contain letters, numbers and underscores (_). At this point you have already a valid parmeter definition, and can stop right there if you like, but there are two more optional part of the definition that can be used for your comfort.

First, you can enter a colon followed by a type definition for the variable. There are three possible data types, namely string, integer and boolean. This type definition will make the program help you check the validity of the values that the user supplies for the parameter in question during the execution of the macro. It will also make the program display specialized input dialogs for the different data types when executing the macros from the GUI. Parameters of the type integer will only accept integers for their values, and parameters of the type boolean will only accept the strings TRUE and FALSE for their values. Finally, parameters of the type string will accept arbitrary strings for their values, including spaces and any special characters. If you leave out the type definition completely, it will default to string.

The second optional part of the parameter definition is the default value definition. It consists of an equal sign followed by a default value for the parameter. When executing macros from the GUI, this value will be automatically suggested to the user, and when executing macros from the command-line, this value will be used if no other value has been specified for the parameter in question.

Here follow some examples of valid parameter definitions:

param %SomeParameterName1%
param %SomeParameterName2% : integer
param %SomeParameterName3% : integer = 5
param %SomeParameterName4% = 5
param %SomeParameterName5% : boolean
param %SomeParameterName6% : boolean = TRUE
param %SomeParameterName7% = TRUE
param %SomeParameterName8% : string
param %SomeParameterName9% : string = Any string here
param %SomeParameterName10% : string = <Artist> - <Title>.mp3
param %SomeParameterName11% = <Artist> - <Title>.mp3

Note: All parameter definitions must be located at the very top of the macro file!


Also, this thread belongs in the support forum, and I will move it there soon.

--------------
Software author and website owner
Back to top
Profile PM WEB 
1 replies since July 17 2005,22:07 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]