1

Topic: [OSX] Droplet to start server with cfg file

Hi! Here is my AppleScript based droplet to start Teeworlds Server simply dropping on it a cfg file. It supports custom maps and custom path of folder maps (you have to customize it)

on open of the_file
    
    set the_file to quoted form of (POSIX path of (the_file))
    -- this is the path of the folder containing a folder called "maps"
    -- in which there are maps: (customize it)
    set the_map_folder to "/Applications/Game/Teeworlds/"
    
    -- this is the path of the folder containing Teeworlds Server.app (customize it)
    set the_app_folder to "/Applications/Game/Teeworlds/"
    tell application "Terminal"
        
        set cmd to "cd " & the_map_folder & ";" & the_app_folder & "'Teeworlds Server.app'/Contents/MacOS/teeworlds_srv -f " & the_file
        do script cmd
    end tell
    
    -- display dialog to stop the server
    set x to (display dialog ("Click this to stop server") buttons {"OK"} default button 1 with icon 1 with title "TeewordServer")
    
    if the button returned of x is "OK" then
        do shell script "killall quit 'teeworlds_srv'"
        tell application "Terminal"
            quit
        end tell
    end if
end open

save it as application (or application bundle), put it everywhere you whant an thats it. It's a droplet, so drop file on it.
It uses a "brute force" way to stop the server. Suggestions are welcome.

Jeby