My script folderico.bat
was the topic of my first blog post on my German Blog “Thragors Blog”. And now it's the first blog post which I translate to English.
Put to start right off with the script: My target was to let CD covers of my ripped CDs appear right in the Windows Explorer. Of course you can do so by editing the properties of your folder right in the Windows GUI. But if you have many folders to change this a laborious work.
So I thought of a way to modify the file Desktop.ini which is responsible for changing the icon via a MSDOS-Batch-Script. I wouldn't call myself an expert in writing Bash scripts but thanks to Rob van der Woude's Scripting Pages I finally accomplished the mission.
While my first post on this issue was on March 21st, 2007 (wow, nearly two years ago now) there is meanwhile a version 1.1 since December 6th, 2007.
Version 1.1 fixed some problems I detected. I am mentioning them in here just in case you also stumble across them in your own scripts:
- When I called V1.0 of the script without arguments I got an error message. Now it shows the usage guide. Problem was that
set IMG=%IMG:"=%
worked perfectly well for non-empty IMG: It deleted the quotes. But for an empty value of IMG the new value was “=” and so the check
if "%IMG%"=="" goto HELP
failed because it got expanded to:
if "="=="" goto HELP
and raised the error message"="=="" goto HELP" ist syntaktisch an dieser Stelle nicht verarbeitbar.
It's a syntax error message (in German). Sorry, I don't know the English error message. - And I added a check that ImageMagick (which is required by this script) is really available. Otherwise the convert command will fail with an obscure error message — just because there is another convert-command in Windows System32 directory.
Reading the script you might also learn:
- how to deal with errorlevels,
- how to write multiline if-then-else clauses,
- how to work with
setlocal
andendlocal
(here: for enabling extensions) and - how to create a multi-resolution ICO-file with ImageMagick's convert.
Now you may want to download the script... first of all mind that you have to install ImageMagick. And then you can download the batch file from box.net:
No comments:
Post a Comment