2011/03/09

How to convert a Mac-Unix style path to a Windows style path from Skim

Sometimes, I want to open a PDF file in my Windows virtual machine. To make things faster I wrote an AppleScript which converts the PDF file path of the front Skim window to its proper Windows style and then the converted path is sent to the clipboard.
As a result, all I have to do after the conversion is to paste the new path to the "File" field of the "Open" window in Adobe Acrobat Pro in Windows.

In order for this AppleScript to work properly, you need to customize the variable "WinPath" with the name and the drive letter of your hard drive.

The AppleScript code is the following:
tell application "Skim"
    set FilePath to get the path of front document
    set my text item delimiters to "/"
    set FilePath to text items of FilePath
    set my text item delimiters to "\\"
    set FilePath to (FilePath as text)
    set WinPath to "Z:\\MBProSystem" & FilePath
    set the clipboard to WinPath
end tell

2 comments:

Anonymous said...

nice

Anonymous said...

Thanks for the Applescript code.I am planning to use this in hope that it will very much ease the process that you mentioned by converting the PDF file path of the front Skim window to its proper Windows style.