Life In 19x19
http://www.lifein19x19.com/

KGS: How-to set up SGF file associations on Mac OSX.
http://www.lifein19x19.com/viewtopic.php?f=24&t=3509
Page 1 of 1

Author:  rubin427 [ Fri Mar 25, 2011 10:33 pm ]
Post subject:  KGS: How-to set up SGF file associations on Mac OSX.

Setting up SGF file associations for KGS/CGoban3 on Mac OSX is a topic that comes up from time to time (previous discussions from 2009, 2008, and 2007).

I've come up with an alternative method to that same ends, which I'll be describing here. (The previously discussed methods didn't work for me.) This process has three parts. First we use "automator" and some bash scripting to create a mac-friendly wrapper to kgs that can launch arbitrary SGF files when they are dragged onto the application icon. Secondly, we use OSX native file associations to associate one specific SGF file with the wrapper so that double clicking that SGF will open it in KGS. Finally, we make the file association applicable to all SGF files on the system. These techniques work for me using OSX 10.6.6, your results may vary.

Part 1: An Automator wrapper for KGS
1.1) Launch "Automator" from your apps folder.
1.2) When asked to "Choose a template for your workflow", chose "Application"
Image

1.3) Select the "Run Shell Script" action which is found under Actions->Library
Image

1.4) Set the drop-down menu "Pass input:" to "as arguments"
1.5) Copy and paste the following script into the window:
Code:
if [ "${1}" == ""  ]; then
  /usr/bin/javaws  ~/bin/cgoban.jnlp
else
  /usr/bin/javaws  ~/bin/cgoban.jnlp -nosplash -open $1
fi

in the script above, "~/" is a shortcut notation for "my home directory". You can see I keep my copy of cgoban.jnlp file in ~/bin/. You may need to adjust this path to point to where you keep your copy of cgoban.jnlp.
1.6) Chose "save as" from the file menu. I suggest you save the application in either /Applications, or in ~/Applications. Name the application whatever you like, I've chosen "auto_kgs".

Testing our progress so far: Open the finder to the folder where you've saved the wrapper application in step 1.6. You should see a new application with your chosen name. double-clicking this application should open KGS. Dragging any SGF file onto this application should open that SGF in KGS. If either of these tests fail, something has gone wrong.

Part 2: Setting up file associations for one specific SGF file
2.1) Double click (or control+click) any sgf file.
2.2) Chose "Open with ->" "Other".
2.3) Find your application created in step 1.6. Checkmark the box "Always open with". Finally, click open.
2.4) This specific sgf file should always open in KGS from now on.

Part 3: Expanding file associations for all SGF files
3.1) Double click (or control+click) on the specific sgf file from part 2.
3.2) Choose "Get Info" from the menu.
3.3) Expand the "Open with:" drop-down menu
3.4) Make sure your wrapper application from step 1.6 is listed in the "Open with:" drop-down menu.
3.5) Click on the "Change All..." button
Image

3.6) Click on "Continue" when the pop-up pops up.

Well, with any luck, it's now working for you.

Edit History:
Sat March 26, added instructions for part three, revised previous steps slightly.

Author:  Jedo [ Sat Mar 26, 2011 9:38 am ]
Post subject:  Re: KGS: How-to set up SGF file associations on Mac OSX.

Very cool idea, I'll be thrilled if this works.

Problem: I was doing part 1, but when I tested the autokgs automater it tried to launch javaweb start but then crashed, saying unable to launch application. Ideas?

I did a quick spotlight search, and I couldn't find a cgoban.jnlp file on my comp, despite using the cgoban app all the time. huh?

Author:  rubin427 [ Sun Mar 27, 2011 8:47 am ]
Post subject:  Re: KGS: How-to set up SGF file associations on Mac OSX.

Jedo wrote:
I did a quick spotlight search, and I couldn't find a cgoban.jnlp file on my comp, despite using the cgoban app all the time. huh?


Visit the KGS download site:
http://www.gokgs.com/download.jsp

Image


Image


Right-Click on the link, "CGoban for Java Web Start", and choose "Download linked file as...". Wherever you download the file to, you need to modify the bash script to match.

To provide a specific example, lets say you download cgoban.jnlp to /Applications, then you need to adjust the bash script used in Part 1.5 to the following:

Code:
if [ "${1}" == ""  ]; then
  /usr/bin/javaws  /Applications/cgoban.jnlp
else
  /usr/bin/javaws  /Applications/cgoban.jnlp -nosplash -open $1
fi

Author:  GoAcademy [ Sat Oct 03, 2015 5:21 am ]
Post subject:  Re: KGS: How-to set up SGF file associations on Mac OSX.

Thanks a lot for this explanation. It still works perfectly for me (I am using Mac OS X 10.11 El Capitan). The only issue I had was with my file structure. You should not have any white spaces neither in the filename nor in the path.

Author:  xed_over [ Sat Oct 03, 2015 7:12 am ]
Post subject:  Re: KGS: How-to set up SGF file associations on Mac OSX.

GoAcademy wrote:
Thanks a lot for this explanation. It still works perfectly for me (I am using Mac OS X 10.11 El Capitan). The only issue I had was with my file structure. You should not have any white spaces neither in the filename nor in the path.


quote the last argument to fix that
Code:
if [ "${1}" == ""  ]; then
  /usr/bin/javaws  /Applications/cgoban.jnlp
else
  /usr/bin/javaws  /Applications/cgoban.jnlp -nosplash -open "$1"
fi

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/