36 lines
1.3 KiB
AppleScript
36 lines
1.3 KiB
AppleScript
|
# Allows you to select a wine prefix to run with audiogame manager
|
||
|
#Get Working Directory
|
||
|
tell application "Finder"
|
||
|
set currentPath to container of (path to me) as alias
|
||
|
end tell
|
||
|
#format Converters
|
||
|
on convertPathToAlias(thePath)
|
||
|
tell application "System Events"
|
||
|
try
|
||
|
return (path of disk item (thePath as string)) as alias
|
||
|
on error
|
||
|
return (path of disk item (path of thePath) as string) as alias
|
||
|
end try
|
||
|
end tell
|
||
|
end convertPathToAlias
|
||
|
|
||
|
on convertPathToPOSIXString(thePath)
|
||
|
tell application "System Events"
|
||
|
try
|
||
|
set thePath to path of disk item (thePath as string)
|
||
|
on error
|
||
|
set thePath to path of thePath
|
||
|
end try
|
||
|
end tell
|
||
|
return POSIX path of thePath
|
||
|
end convertPathToPOSIXString
|
||
|
|
||
|
set currentPath to convertPathToPOSIXString(currentPath)
|
||
|
set folderPath to POSIX file "~/.local/wine/"
|
||
|
set folderPath to convertPathToAlias(folderPath)
|
||
|
set gameFolder to choose folder with prompt "Choose your game and press enter:" default location folderPath
|
||
|
set gameFolder to convertPathToPOSIXString(gameFolder)
|
||
|
set gameFolder to quoted form of gameFolder
|
||
|
set gameName to do shell script ("basename " & gameFolder)
|
||
|
do shell script "/usr/local/bin/bash -l " & currentPath & "audiogame-manager.sh -l " & gameName & " &> /dev/null &"
|
||
|
do shell script "say -v alex Launching " & gameName & ", please wait..."
|