[ul]
[li] montage.exe - grab it from a portable version of ImageMagick ftp://ftp.imagemagick.org/pub/ImageMagick/binaries/
e.g. ImageMagick-7.0.3-7-portable-Q16-x64.zip
You can just extract the montage.exe directly, no need for anything else
[/li]
[li] Various icons you want to use from wherever you want:
e.g. flaticon.com/packs/interface-icon-assets
Rename them to match Directory Opus icon names if you want to use them to override standard icons by default[/li][/ul]
Instructions:
[ul]
[li] Put montage.exe, zip.exe, doicon.bat and your icons somewhere useful on your machine, so you have:
montage.exe
zip.exe
doicons.bat
bunch of icons
[/li]
[li] Use doicon.bat file in the same location, and run it like this:
doicon.bat sourcefiles destinationname
for example
doicon.bat *.png MyAmazingIcons
[/li]
[li] Watch with amazement as your icons get squished into a 22x22 version and a 32x32 version and wrapped up into a Directory Opus .dis file
[/li]
[li] If you didn't bother getting zip.exe then you will receive:
MyAmazingIcons.xml
MyAmazingIcons-22.png
MyAmazingIcons-32.png
you'll need to zip these up yourself and rename the resulting zip file to .dis, which Directory Opus can then use
[/li]
[li] Import into Directory Opus
[/li]
[li] PROFIT!![/li][/ul]
Hope this comes in useful to someone!
[ul]
[li] 2016-11-23 Fixed error where zipped file would contain paths, and added a 1px border around the tiles[/li]
[li] 2016-11-23 Updated batch file so that it doesn't include the -22.png and -32.png inside themselves.[/li][/ul] doicon.zip (840 Bytes)
Nice idea, but it adds lines for "test-22.png" and "test-32.png" to "test.xml" and "test-22.png" will appear as an icon in "test-32.png". Montage.exe should probably create these images outside the source folder.
You can run the batch from a button type "MSDOS batch function". This button code requires montage.exe and optionally zip.exe located in a path thats present in the PATH environment variable of windows. Otherwise you'll have to provide the path to montage.exe in line 8 and 9 and for zip.exe in line 47. Montage exe will create the images in %temp% and they are moved to sourcepath when writing the XML was finished. You will be asked for the required values for files and the name of the iconset by a dialog.
[code]@externalonly @runmode hide @set files = {dlgstring|Select files:|*.png} @set name = {dlgstring|Enter name of Iconset:}
cd {sourcepath}
chcp 65001 @echo off
setlocal EnableDelayedExpansion
montage {$files} -geometry 20x20+1+1 -tile 16 -background transparent %temp%\{$name}-22.png
montage {$files} -geometry 30x30+1+1 -tile 16 -background transparent %temp%\{$name}-32.png
echo. > {$name}.tmp
set row=1
set col=1
for %%i in ({$files}) do (
echo ^<icon row="!row!" col="!col!" name="%%~ni"/^> >> {$name}.tmp
set /A col=col+1
if !col! GTR 16 (
set col=1
set /A row=row+1
)
)
echo. >> {$name}.tmp
echo ^<?xml version="1.0" encoding="UTF-8"?^> > {$name}.xml
echo ^<iconset name="{$name}"^> >> {$name}.xml
echo ^<display_name^>{$name}^</display_name^> >> {$name}.xml
echo ^<copyright^>^</copyright^> >> {$name}.xml
echo ^<artist^>^</artist^> >> {$name}.xml
echo ^<set filename="{$name}-22.png" height="22" size="small" width="22"^> >> {$name}.xml
type {$name}.tmp >> {$name}.xml
echo ^</set^> >> {$name}.xml
echo ^<set filename="{$name}-32.png" height="32" size="large" width="32"^> >> {$name}.xml
type {$name}.tmp >> {$name}.xml
echo ^</set^> >> {$name}.xml
echo ^</iconset^> >> {$name}.xml
del {$name}.tmp
move %temp%\{$name}-22.png {sourcepath}
move %temp%\{$name}-32.png {sourcepath}
if exist zip.exe (
zip {$name}.dis {$name}-22.png {$name}-32.png {$name}.xml
del {$name}-22.png
del {$name}-32.png
del {$name}.xml
)
goto :eof
Nicely done - I'm using my version to quickly re-generate the same icon set with minor changes without having to select the PNGs or re-enter the icon set name.
You could put montage.exe and zip.exe in a /dopusdata/Tools subfolder then you'd be able to find them via that alias.
Also, will "cd {sourcepath}" work if the path is on a different drive?
I think since DOpus 11 the default working folder for functions called by toolbar buttons is /system (\Windows\system32). cd {sourcepath} is needed to make the command working on the current active tab. It should work everywhere if the tool you called supports this.
There's an advanced option in Preferences=>Miscellaneous=>Advanced which allows changing the default working folder to {sourcepath}: def_func_cd_sourcedir
I think Tenebrous was asking if you wanted to use "cd {sourcepath}" or "cd /D {sourcepath}" since the DOS CD command (unlike the Opus CD command) can't change both drive and folder at once unless /D is specified.
In this particular case, it may not matter. Even with a DOS Batch button type and @externalonly specified, if the cd command before any other external commands in the batch file (ignoring any Opus @modifiers and any other cd commands), then Opus will handle it specially, and it does not matter if it has /D or not. If it was lower down then you would need the /D if you were changing to another drive.
(In normal buttons, when not using the DOS Batch type, you shouldn't use /D at all.)
The button code I provided above produced invalid XML files if an icon name contained german Umlauts like ü or ä. DOpus didn't show the resulting iconsets. I added the line chcp 65001 to the code to make it working correctly.
Here we go:
button type: script function. zip.exe isn't needed because DOpus can do that.[code]Option Explicit
Function OnClick(data)
Dim all, archive, cmd, col, files, i, name, objStream, objOutputFile, row, text
files = DOpus.Dlg.GetString("Select files:","*.png")
name = DOpus.Dlg.GetString("Enter name of Iconset:")
Set cmd = data.Func.Command
Set text = DOpus.FSUtil.Resolve(cmd.sourcetab.path & "" & name & ".xml")
Set objStream = CreateObject("ADODB.Stream")
objStream.CharSet = "utf-8"
objStream.Open
row=1
col=1
Can someone please help me? I have wanted to make icon packages for years but didnt know such a tool exists. Its awsome!
For some reason montage puts multiple icons of the same icon. A package with 6 icons ends up with over 20.... Thanks so much! I just realized it only happens when using .ico files. With .png it works fine