It is currently Fri Mar 29, 2024 5:34 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
Offline
 Post subject: KGS: How-to set up SGF file associations on Mac OSX.
Post #1 Posted: Fri Mar 25, 2011 10:33 pm 
Lives in gote

Posts: 338
Location: Las Vegas, NV
Liked others: 163
Was liked: 62
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.


This post by rubin427 was liked by 2 people: ericf, tj86430
Top
 Profile  
 
Offline
 Post subject: Re: KGS: How-to set up SGF file associations on Mac OSX.
Post #2 Posted: Sat Mar 26, 2011 9:38 am 
Lives in gote
User avatar

Posts: 588
Location: NY
Liked others: 124
Was liked: 46
Rank: 2D KGS
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?

_________________
"There are no limits. There are plateaus, but you must not stay there, you must go beyond them. If it kills you, it kills you. A man must constantly exceed his level." -- Bruce Lee

Top
 Profile  
 
Offline
 Post subject: Re: KGS: How-to set up SGF file associations on Mac OSX.
Post #3 Posted: Sun Mar 27, 2011 8:47 am 
Lives in gote

Posts: 338
Location: Las Vegas, NV
Liked others: 163
Was liked: 62
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


This post by rubin427 was liked by: Jedo
Top
 Profile  
 
Offline
 Post subject: Re: KGS: How-to set up SGF file associations on Mac OSX.
Post #4 Posted: Sat Oct 03, 2015 5:21 am 
Beginner

Posts: 12
Liked others: 0
Was liked: 5
KGS: Oel
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.

Top
 Profile  
 
Offline
 Post subject: Re: KGS: How-to set up SGF file associations on Mac OSX.
Post #5 Posted: Sat Oct 03, 2015 7:12 am 
Oza

Posts: 2264
Liked others: 1180
Was liked: 552
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

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group