Search code examples
macoswineheidisql

problem creating Mac launcher script for wine/heidisql


Ok, mac scripts are completely new to me, and I have no idea how to debug this.

I have installed wine from the pkg (not from brew etc) and installed heidisql with wine.

As per instructions, I created this in the mac script editor, saved it as "application" and copied it to Applications folder.

NOTE: I can run heidisql by running "wine stable" in the launcher, then typing in

wine "$HOME/.wine/drive_c/Program Files/HeidiSQL/heidisql.exe"

The script which doesn't work:

on run

    --edit this to be the correct location and file to run (typically only edit after the "drive_c")
    set toRun to "$HOME/.wine/drive_c/Program Files/HeidiSQL/heidisql.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

However, when I run the application script by double-clicking on it in the application folder, it flashes up the script icon in the taskbar, then does nothing. Any idea what's wrong, or how to debug?


Solution

  • Final solution. Did "which wine" to find out where the installer put it, and replaced /usr/bin/local in script.

    on run
    
        --edit this to be the correct location and file to run (typically only edit after the "drive_c")
        set toRun to "$HOME/.wine/drive_c/Program Files/HeidiSQL/heidisql.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"
        set wineLocation to "/Applications/Wine Stable.app/Contents/Resources/wine/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