IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> How to create a shortcut file to a physical file?, Mp3tag export script creates Visual Basic Script.
DetlevD
post Sep 13 2010, 20:57
Post #1


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



There was a user request ...
http://forums.mp3tag.de/index.php?showtopi...ost&p=48685
... for creating a shortcut file within a new folder, targetting a real file anywhere else on the disk. Such a feature would allow to create a "virtual catalog" or an user defined "view" to the existing file base. Yes, the effect is something like a m3u file could deliver too.

Mp3tag has no built in feature to create link files from real files yet.
But the idea sounds interesting, anyway, and I have tried something into this direction using the Mp3tag export feature.

I put together a Mp3tag export file, which creates a textual Visual Basic Script file.
A VBS script can run directly on a Windows operating system like a BAT or CMD script, when the Windows Script Host (WSH), a well known Windows administration tool, is installed.
The Windows Script Host is built into Microsoft Windows 98 and later versions of Microsoft Windows.
To upgrade to the latest version of Windows Script Host, search for "Windows Script Host" on the Microsoft Download Center.
You can determine your Windows Script Host version number by typing CScript at a command prompt.


The attached Mp3tag export script demonstrates how it could be realized to build a folder tree full of link files pointing to real files, still residing in there home folders.
Mp3tag provides the data and the Windows Shell does the filesystem job.

My proposal script will create a folder tree starting at a given root folder e. g. "O:\TEST\BPM\".
Because of some quirks in the Mp3tag export scripting language, this root folder has to be defined respectively adapted in the export script at different places, see lines which contain "$puts(My_RootFolder,'...".

For each different BPM value in the group of selected tracks the script will create a new folder named by this specific BPM value, e. g. BPM value is 120, the folder is named to "BPM 120".
Within this folder there will be created a link file (or more), which points to the physical file with the correlating BPM value.
This way all files with the same BPM value, respectively their link files, will be aggregated into one folder. Note: This can only work successfully when each filename is unique!

When using additionally VB script code, it should be possible to ask the user for more input details or let pick the root folder by a standard Open Folder system dialog. This task is left to the user.

When Mp3tag has finished the "20100913.BuildCat_BPM.mte" export script, the result is a text file named "BuildCat_BPM.vbs".
If execution of VBS scripts is allowed on the system, then the VBS script can be executed automatically by answering "Yes" to the last export dialog ("show result").

Enjoy!
Attached File  20100913.BuildCat_BPM.mte ( 2.07K ) Number of downloads: 164


DD.20100913.2145.CEST
Edit. Small changes in the export script.
DD.20100914.1042.CEST

This post has been edited by DetlevD: Sep 14 2010, 09:44


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 15 2010, 14:51
Post #2


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



QUOTE (DetlevD @ Sep 13 2010, 21:57) *
... I put together a Mp3tag export file, which creates a textual Visual Basic Script file. ... The attached Mp3tag export script demonstrates how it could be realized to build a folder tree full of link files pointing to real files, still residing in there home folders. ...

Here comes an advanced script version 2.1 providing a "Browse For Folder" dialog.
Mp3tag export script file: BuildCat_BPM_2.1.mte

Attached File  20100916.BuildCat_BPM_2.1.mte ( 4.66K ) Number of downloads: 174


DD.20100916.0810.CEST

This post has been edited by DetlevD: Sep 16 2010, 07:09


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
ryerman
post Sep 16 2010, 18:12
Post #3


Member


Group: Full Members
Posts: 77
Joined: 16-August 09
From: Canada
Member No.: 10731
Mp3tag Version: 2.58



Thanks for sharing your code. It seems clear and well documented, even to a non-professional like me. I like how you used a popup message to indicate the progress of creating folders. I often wish VBS had some method to show a progress bar.

Here's a quote from you in another thread:
QUOTE (DetlevD @ Sep 13 2010, 05:42) *
..., when realized in programming code, would be a nice feature for Mp3tag with enormous potential for creating and structuring user dependend "virtual" catalogs directly on disk by simply using the filesystem as the basic database.

DD.20100913.1142.CEST

I agree. Your mte file is a good example that illustrates the potential. I may not need a folder full of short-cuts but your example provides an excellent template for creating other VBS scripts.
I'd like to try creating a multi-dimensional array that contains tag information gleaned from MP3Tag. Maybe it could be used for manipulating supported audio files.

Thanks again,
Jim


--------------------
Windows 7, Home Premium, SP1
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 16 2010, 21:35
Post #4


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



QUOTE (ryerman @ Sep 16 2010, 19:12) *
Thanks for sharing your code. It seems clear and well documented, even to a non-professional like me. ... your example provides an excellent template for creating other VBS scripts.
I'd like to try creating a multi-dimensional array that contains tag information gleaned from MP3Tag. Maybe it could be used for manipulating supported audio files. Thanks again, Jim

Jim, thank you for your kind words.
If I ever have given you a push into the direction of VBS and Mp3tag scripting, then go ahead and try it out what you are thinking about!

Regards
Detlev

DD.20100916.2234.CEST


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 16 2010, 21:40
Post #5


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



Here comes an advanced Mp3tag export script version 2.2, which demonstrates how to create a foldertree of genre related subfolders.

There is a new VBS dialog, which asks for suppressing of info details (e. g. creating of subfolder) in order to let the runtime of the created VBS script as short as possible.

Mp3tag export script file: BuildCat_GENRE_2.2.mte
<removed>

DD.20100916.2246.CEST
Edit.DD20100917.1608.CEST

This post has been edited by DetlevD: Sep 17 2010, 15:09


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
helen07
post Sep 17 2010, 04:00
Post #6


Member


Group: Banned
Posts: 1
Joined: 17-September 10
Member No.: 12943
Mp3tag Version: ID3



Thanks for your contribution! I highly appreciate your suggestion. It's very helpful. Hope to see more interesting comments!

Helen


--------------------
removed by moderation
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 17 2010, 15:06
Post #7


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



There might exist GENRE tag-field content which looks like "Pop/Rock" or "Pop\Rock".
When using the "BuildCat_GENRE_2.2.mte" script such GENRE content will trigger the script to create additional subfolders under the main genre, for example, genre "Pop/Rock" will create a folder "Rock" within the folder "Pop":
"Pop"
--- "Rock"
This might be useful or not, who knows?

But there might exist GENRE tag-field content which looks like "Pop / Rock" or "Pop \ Rock", note the space characters around the slash delimiters.
Such genre tag-field content leads to bad circumstances in the file system, and can break the VBS script with error code 80070003 and error message like "Link cannot be saved".

To avoid such problems I have changed the specific script line ...
from ...
'Mp3tag_SubfolderNew = "'$if2($trim(%GENRE%),'_Unknown')'" & "\"'
to ...
'Mp3tag_SubfolderNew = "'$if2($trim($validate(%GENRE%,'-')),'_Unknown')'" & "\"'

This will create "Pop-Rock" or "Pop - Rock" genre folders and avoids the creation of further subfolders.

20100917.BuildCat_GENRE.2.3.mte
<removed>

DD.20100917.1606.CEST
Edit.20100920.2359.CEST

This post has been edited by DetlevD: Sep 20 2010, 22:59


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
DetlevD
post Sep 20 2010, 22:58
Post #8


Member


Group: Full Members
Posts: 4602
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.58



Here comes a fresh version of "20100920.BuildCat_GENRE.3.0.mte".
<file removed>

This Mp3tag export script generates smaller VBS script output than versions before, because of the usage of functions and procedures.

When the VBS script is running, now the user has the choice to see info details or not or break the running process.

DD.20100920.2358.CEST


New version "20100922.BuildCat_GENRE.3.1.mte".
Now smaller VBS script output than versions before.
Now more info details.

Attached File  20100922.BuildCat_GENRE.3.1.mte ( 13.31K ) Number of downloads: 287


DD.20100922.2346.CEST

This post has been edited by DetlevD: Sep 22 2010, 22:46


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th April 2014 - 10:41