lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interactive PDF Link to Notes in Preview


From: Mats Behre
Subject: Re: Interactive PDF Link to Notes in Preview
Date: Mon, 9 Jul 2018 07:26:37 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.0

On 2018-07-08 19:56, Federico Bruni wrote:

    I found this: 
https://superuser.com/questions/548119/how-do-i-configure-custom-url-handlers-on-os-x
 and downloaded SwiftDefaultApps. It works on High Sierra, don't know about El 
Capitan, but if not it seems that RCDefaultApp should do the trick for you.

Can you be more specific?
What do you mean with "it works"?
Which command did you assign for textedit protocol?

Yesterday I read a similar answer and installed RVDefaultApp. Now I can set 
which application should open textedit:// URIs.
However I cannot set the text editor directly, as the text editor cannot handle 
this protocol.

I guess I should use lilypond-invoke-editor but, as I've already reported, I 
could not make it work on either Mac or Windows.

It looks like it's the last step to get what I want.


OK, then you are in more or less the same situation as me - you need a small 
helper app that takes the URI and invokes your editor.
I have a small AppleScript app which does this (I think I got the base for it 
from the LilyPond site ages ago):

roperty urlPrefix : "textedit://"

on replaceText(find, replace, subject)
        set prevTIDs to text item delimiters of AppleScript
        set text item delimiters of AppleScript to find
        set subject to text items of subject
        
        set text item delimiters of AppleScript to replace
        set subject to "" & subject
        set text item delimiters of AppleScript to prevTIDs
        
        return subject
end replaceText

on open location texteditURL
        
        -- strip prefix
        set the character_count to the number of characters of the urlPrefix
        set the emacsclientURL to (characters (the character_count + 1) thru -1 
of the texteditURL) as string
        
        -- extract PATH LINE and COLUMN
        set AppleScript's text item delimiters to ":"
        set emacsclientPATH to first text item of emacsclientURL
        set emacsclientLINE to second text item of emacsclientURL
        set emacsclientCOLUMN to third text item of emacsclientURL
        set AppleScript's text item delimiters to ""
        
        set emacsclientPATH to replaceText("%20", "\\ ", emacsclientPATH)
        
        -- launch emacsclient
        do shell script "/Applications/Eddie/tellEddie " & quoted form of emacsclientPATH & ":" & 
emacsclientLINE & ":" & emacsclientCOLUMN
        
end open location

My problem now is that SwiftDefaultApps silently fails to set this as the 
textedit target, possibly because my info.plist is too old (it has worked in 
the past):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>CFBundleAllowMixedLocalizations</key>
        <true/>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleExecutable</key>
        <string>applet</string>
        <key>CFBundleIconFile</key>
        <string>applet</string>
        <key>CFBundleIdentifier</key>
        
<string>com.apple.ScriptEditor.id.1A1CE0AF-AC45-4636-9B72-8CBBFCDA88F5</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>lilypoint</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleSignature</key>
        <string>aplt</string>
        <key>CFBundleURLTypes</key>
        <array>
                <dict>
                        <key>CFBundleTypeRole</key>
                        <string>Editor</string>
                        <key>CFBundleURLName</key>
                        <string>text editor via url</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <string>textedit</string>
                        </array>
                </dict>
        </array>
        <key>LSMinimumSystemVersionByArchitecture</key>
        <dict>
                <key>x86_64</key>
                <string>10.6</string>
        </dict>
        <key>LSRequiresCarbon</key>
        <true/>
        <key>WindowState</key>
        <dict>
                <key>bundleDividerCollapsed</key>
                <true/>
                <key>bundlePositionOfDivider</key>
                <real>0.0</real>
                <key>dividerCollapsed</key>
                <false/>
                <key>eventLogLevel</key>
                <integer>2</integer>
                <key>name</key>
                <string>ScriptWindowState</string>
                <key>positionOfDivider</key>
                <real>680</real>
                <key>savedFrame</key>
                <string>1238 373 1015 944 0 0 2560 1417 </string>
                <key>selectedTab</key>
                <string>log</string>
        </dict>
</dict>
</plist>

I have not yet had time to find out what the problem is - you may be luckier.

/mb



reply via email to

[Prev in Thread] Current Thread [Next in Thread]