December 7, 2009
Email sign up
Copy Path (Mac)
Surround SCM
Works with Surround SCM 2010 and later
Will not work with Surround SCM 2009 and earlier
Overview
This is a short sample showing how to leverage the new client menu integration in Surround SCM 2010 and AppleScript on the Mac. This sample shows how to add a file context menu item which copies the sscm:// path to the clipboard for pasting into another application. The XML file for the menu is simple enough (Please refer to the Surround SCM Custom Client Menus article for help on creating a custom menu option to access the tool)<Surround-Plugin version="1.0">
<menu-item name="CopyPath">
<location type="contextfile" />
<enabling>
<file-selection required="true" value="1" />
</enabling>
<action path='/usr/bin/osascript "/Applications/Surround SCM/plugins/copypath.app"' wait-for-completion="false" timeout="60">
</action>
</menu-item>
</Surround-Plugin>
The AppleScript is nearly as simple:
on run argv set the clipboard to (system attribute "SSCM_FILELINK" as string) end run