I use Homebrew to install wine to run Microsoft compatible apps
Install Homebrew by following the instructions from http://brew.sh/
brew update
brew install wine
Install your Microsoft Windows App
... mount DVD or ISO image, or copy the contents of the DVD to a USB key if you don't have a DVD player for your mac, launch a terminal
# cd /path/to/your/DVD/or/USBDrive/orMountedISOImage
# e.g.
cd /Volumes/WTLIB15E
wine ./Setup.exe
Create your Apple Script launcher and save it as an .app file
Open script editor, paste in the launch script listed below (edited to suit the path to your application executable and your wine environment)
The script editor saves an application with a default Apple Script icon.
The example on the left has had a custom icon applied the one on the right is the default. See below for how to extract the Microsoft *.ico icon from the executable and then create a Mac compatible icns file.
on run --edit this to be the correct location and file to run (typically only edit after the "drive_c") set toRun to "$WINEPREFIX/drive_c/Program Files/Watchtower/Watchtower Library 2015/E/wtlibrary.exe" --edit winePrefix if you are not using the default prefix set winePrefix to "$HOME/.wine" --edit wineLocation if your wine install is not the default location set wineLocation to "/usr/local/bin" --edit dyldFallbackLibraryPath to your X11 lib folder, this one is set for XQuartz on 10.6+ set dyldFallbackLibraryPath to "/opt/X11/lib" ------------------------------------------------------- --DO NOT EDIT ANYTHING BELOW THIS LINE ------------------------------------------------------- set toRunPath to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; echo \"${TEMPVAR%/*}\"" set toRunFile to do shell script "WINEPREFIX=\"" & winePrefix & "\"; TEMPVAR=\"" & toRun & "\"; TEMPVAR2=\"" & toRunPath & "\"; echo \"${TEMPVAR#$TEMPVAR2/}\"" do shell script "PATH=\"" & wineLocation & ":$PATH\"; export WINEPREFIX=\"" & winePrefix & "\"; export DYLD_FALLBACK_LIBRARY_PATH=\"" & dyldFallbackLibraryPath & "\"; cd \"" & toRunPath & "\"; wine \"" & toRunFile & "\" > /dev/null 2>&1 &" end run
Adding Watchtower Library Icon to the Apple Script Launcher
This page has some really nice instructions on how the process works: http://loekvandenouweland.com/content/replacing-default-applescript-application-icon-with-a-custom-icns-file
You need icoutils install using brew
# install icon utilities
brew install icoutils
# copy the wtlibrary exe into a work directory
# to get the main icon from it
# first create a folder to work from
mkdir ~/wtlib_icon
cp ~/.wine/drive_c/Program\ Files/Watchtower/Watchtower\ Library\ 2015/E/wtlibrary.exe ~/wtlib_icon/
cd ~/wtlib_icon/
# wrestool -l filename.exe lists all the icons in the exe
# we need the main icons exact name
wrestool -l wtlibrary.exe | grep -i main
--type=14 --name='IDI_MAIN_ICON' --language=1033 [type=group_icon offset=0xda64a8 size=146]
# extract just that icon using it's name
wrestool -x -n IDI_MAIN_ICON wtlibrary.exe > main.ico
# now dump all the different icon images to disk
icotool -x main.ico
# lots of different resolutions
ls
main.ico main_1_48x48x4.png main_3_20x20x4.png main_5_48x48x8.png main_7_20x20x8.png main_9_48x48x32.png
main_10_32x32x32.png main_2_32x32x4.png main_4_16x16x4.png main_6_32x32x8.png main_8_16x16x8.png wtlibrary.exe
I had this piece of code using png2icns which I can't find on my system
# png2icns only support some resolutions so pick the highest res of 48x48, 32x32 and 16x16
# then create the applet.icns file
png2icns applet.icns main_9_48x48x32.png main_10_32x32x32.png main_8_16x16x8.png
Using icns type 'ih32', mask 'h8mk' for 'main_9_48x48x32.png'
Using icns type 'il32', mask 'l8mk' for 'main_10_32x32x32.png'
Using icns type 'is32', mask 's8mk' for 'main_8_16x16x8.png'
Saved icns file to applet.icns
But there seems to be a native program that can do the same job names sips
sips -s format icns main_9_48x48x32.png --out applet.icns
Once you have the icns file you need to copy it into the
cp applet.icns /Applications/Watchtower\ Library.app/Contents/Resources/
# you need to tell the mac that the icon has been updated
# just touch the following two files to get the mac to update it in the gui
touch /Applications/Watchtower\ Library.app
touch /Applications/Watchtower\ Library.app/Contents/Info.plist
When you have done the above the apple script .app file appears in Launchpad with it's new custom icon
0 Comments