tag:support.markedapp.com,2011-09-11:/discussions/questions/7-why-does-the-open-in-marked-service-open-texteditMarked: Discussion 2018-10-19T05:38:35Ztag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T10:42:09Z2011-09-20T10:42:09ZWhy does the "Open in Marked" service open TextEdit?<div><p>Hi Chris,</p>
<p>Have you downloaded the latest version? It was a bug in the
upload prior to the latest, but shouldn't be happening now.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T11:27:56Z2011-09-20T11:27:56ZWhy does the "Open in Marked" service open TextEdit?<div><p>I just re-downloaded from here and it is definitely still
happening.</p></div>Chris Lawrencetag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T11:35:40Z2011-10-10T13:45:45ZWhy does the "Open in Marked" service open TextEdit?<div><p>Woops, link didn't embed: <a href=
"http://support.markedapp.com/kb/how-to-tips-and-tricks/marked-bonus-pack-scripts-commands-and-bundles">
http://support.markedapp.com/kb/how-to-tips-and-tricks/marked-bonus...</a></p></div>Chris Lawrencetag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T12:18:35Z2011-09-20T12:18:35ZWhy does the "Open in Marked" service open TextEdit?<div><p>The "Open Current File in Marked" service <a href=
"http://brettterpstra.com/downloads/MarkedBonusPack.zip">found
here</a>?</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T12:26:19Z2011-09-20T12:26:19ZWhy does the "Open in Marked" service open TextEdit?<div><p>Yeah, woops my link didn't embed, but that is the one I
downloaded. I just redownloaded and installed and it's still
happening.</p></div>Chris Lawrencetag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T12:31:52Z2011-09-20T12:31:52ZWhy does the "Open in Marked" service open TextEdit?<div><p>Did you delete the previous version before installing the new
one? In your title you reference "Open in Marked," which is not the
service that's included in that pack. "Open Current File in Marked"
is, and I can verify that the bug is not in that file (just
downloaded and checked).</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T14:24:30Z2011-09-20T14:24:30ZWhy does the "Open in Marked" service open TextEdit?<div><p>I am definitely using the most current version of "Open Current
File in Marked". I just deleted the old Service, restarted, and
copied the new one in and I'm still getting TextEdit opening.</p>
<p>Here is the AppleScript in the service:</p>
<p>-- Open in Marked -- Attempts to open the currently-edited
document in Marked for previewing -- By Brett Terpstra <a href=
"http://brettterpstra.com">http://brettterpstra.com</a> -- for
Marked <a href="http://markedapp.com">http://markedapp.com</a> --
Based on ideas by Lri <a href=
"https://gist.github.com/1077745">https://gist.github.com/1077745</a>
-- with contributions from Donald Curtis <a href=
"https://github.com/milkypostman">https://github.com/milkypostman</a></p>
<p>on run {}</p>
<pre>
<code>tell application "System Events"
set frontApp to (name of first process whose frontmost is true)
end tell
tell application frontApp to activate
set f to false
set flist to {}
--Marked (if Marked is foreground, hide Marked and end script)
if frontApp is "Marked" then
tell application "System Events" to set visible of process "Marked" to false
return
--Notational Velocity/nvALT
else if frontApp is "Finder" then
tell application "Finder" to set flist to (get selection)
-- Emacs?
else if frontApp is "Emacs" then
set emacsclient to false
tell application "Finder"
if exists POSIX file "/usr/local/bin/emacsclient" then
set emacsclient to "/usr/local/bin/emacsclient"
end if
end tell
if emacsclient is not false then
set f to do shell script emacsclient & " -e '(first (delete nil (mapcar (function buffer-file-name) (buffer-list))))' | sed 's/^\"//' | sed 's/\"$//'" as string
if f is not "nil" then
set f to f as POSIX file as alias
else
set f to false
end if
end if
--Byword (open current document)
else if frontApp is "Byword" then
tell application frontApp to set f to file of document of window 1 as alias
else if frontApp is "TextEdit" then
tell application "TextEdit" to set f to path of document of window 1 as POSIX file
else
tell application "System Events"
tell process frontApp
try
set isScriptable to has scripting terminology
on error
set isScriptable to false
end try
end tell
end tell
if isScriptable then
try
tell application frontApp to set f to POSIX file (path of document 1 of window 1) as alias
end try
if f is false then
try
tell application frontApp to set f to POSIX file (path of first document) as alias
end try
end if
if f is false then
try
tell application frontApp to set f to POSIX file (text 17 thru -1 of (get URL of document 1)) as alias -- BBEdit
end try
end if
end if
end if
if f is false and flist is not {} then
tell application "Marked"
activate
repeat with afile in flist
open (afile as alias)
end repeat
end tell
else if f is not false then
tell application "Marked"
activate
open f
end tell
end if</code>
</pre>
<p>end run</p></div>Chris Lawrencetag:support.markedapp.com,2011-09-11:Comment/100808592011-09-20T14:55:21Z2011-09-20T14:55:21ZWhy does the "Open in Marked" service open TextEdit?<div><p>I'm honestly not sure why this would be happening. It was a bug
(stupid mistake) that I left in the first version I released, but
it's since been fixed. I've tested locally and have reviewed the
script you just posted for mistakes, and both seem to check out
fine... if you can find anything else that might be overriding the
service in the Service Menu, but I doubt that's the case. Are you
triggering the Service manually or via a shortcut?</p>
<p>Do you have something like FastScripts where you could pull the
AppleScript out, assign a shortcut key to it and trigger it to see
if you get the same result? Or even just run it from AppleScript
Editor and see if TextEdit opens?</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/100808592011-09-21T11:10:37Z2011-09-21T11:10:37ZWhy does the "Open in Marked" service open TextEdit?<div><p>I'm really sorry, I have wasted way too much of your time on
this. I have just started using the Applescript instead with a
Quicksilver trigger and it works exactly the same. I'm assuming
there's something janky going on with my system.</p>
<p>Thanks,<br>
Chris</p></div>Chris Lawrence