Welcome Guest Login Register Member List
ExpressionEngine Forums
Advanced Search
Username: Password:
Remember Me? forgot password?
You are here: Forum Home  >  Usage  >  Tips and Tricks  >  Thread
   
 
quicksilver applescript for adding
 
Craig
Posted: 10 July 2006 05:03 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  28
Joined  2006-06-28

I am an avid user and fan of Luke Melia’s applescript that I can invoke with Quicksilver to add actions to Tracks.

I made a version of the script for each of my contexts. I also replaced the notification with something like this:

tell application "Quicksilver"
            
show notification "Tracks" text "Action added 
to @calls."
        
end tell 

which I thought looked a little better on my Growl.

Here’s my question: is it doable to also include, at the end of a script, instructions to check if Tracks is currently in a browser window, and if so, to refresh that window? It seems like it should be possible but I don’t know enough about Applescript to get it to work.

Signature 

Tracks 1.042 on Locomotive / Camino 1.0.1

Profile
 
bsag
Posted: 15 July 2006 11:21 AM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  218
Joined  2006-03-05

Nice! I’m not an Applescript expert, so I don’t know if you can check whether Tracks is in a browser window, but I would have thought refreshing the window would be reasonably easy.

Profile
 
yogester
Posted: 18 July 2006 09:24 PM   [ Ignore ]   [ # 2 ]  
Newbie
Avatar
Rank
Total Posts:  5
Joined  2006-07-18

I use quicksilver for everything and I have wanted to find a way to integrate it with tracks.

However, I host my tracks on my home mac, but I access it mainly at work. Is there anyway to make this script work in this situation? I am absolutely clueless when it comes to applescript…

Ta,

Yogester

Signature 

TRACKS Trunk served by Mongrel on a iMac G4 - accessed via Firefox and Treo650

Profile
 
yogester
Posted: 18 July 2006 10:07 PM   [ Ignore ]   [ # 3 ]  
Newbie
Avatar
Rank
Total Posts:  5
Joined  2006-07-18

I worked out how to get quicksilver to communicate with my home computer (brain fart, it was in the applescript already) and even what my token was by grabbing it from the RSS feed, I didn’t even know waht a token was. Tracks has taught me so much!

What I have done though is screw up my DB… I am sure when I get home and boot up CocoaMySQL I can sort it out by deleting the record I added incorrectly.

But the problem in the first place was that I named the context_id wrong and it has sent my tracks into a Application Error (Rails) tailspin. So that I get it right next time, how should the contextid be formatted for the AppleScript - e.g. a context called @calls for instance?

Ta!

Yogester

Signature 

TRACKS Trunk served by Mongrel on a iMac G4 - accessed via Firefox and Treo650

Profile
 
yogester
Posted: 18 July 2006 10:16 PM   [ Ignore ]   [ # 4 ]  
Newbie
Avatar
Rank
Total Posts:  5
Joined  2006-07-18

With regards to the first post this is how I did the refresh browser bit.

After the growl notification part add:-

set theActiveURL to "http://0.0.0.0:3000/"
tell application "Firefox"
    
activate
    OpenURL theActiveURL
end tell 

It works for Firefox anyways…

Yogester

Signature 

TRACKS Trunk served by Mongrel on a iMac G4 - accessed via Firefox and Treo650

Profile
 
Craig
Posted: 18 July 2006 10:21 PM   [ Ignore ]   [ # 5 ]  
Newbie
Rank
Total Posts:  28
Joined  2006-06-28
yogester - 18 July 2006 10:07 PM

So that I get it right next time, how should the contextid be formatted for the AppleScript - e.g. a context called @calls for instance?

It doesn’t matter what the context is called, Tracks has assigned it a number for an id. You can get that by going to the feeds page, then checking what the link address is on any of the feeds (rss, text, ical) for that context. For example, you can click on the text feed for @calls and when the new page comes up, look at the address in the browser’s URL bar. It will end in something like “...context=6,” in which case 6 is the contextid to put into your applescript.

Hope that helps.

Signature 

Tracks 1.042 on Locomotive / Camino 1.0.1

Profile
 
Craig
Posted: 18 July 2006 10:23 PM   [ Ignore ]   [ # 6 ]  
Newbie
Rank
Total Posts:  28
Joined  2006-06-28
yogester - 18 July 2006 10:16 PM

With regards to the first post this is how I did the refresh browser bit.

After the growl notification part add:-

set theActiveURL to "http://0.0.0.0:3000/"
tell application "Firefox"
    
activate
    OpenURL theActiveURL
end tell 

It works for Firefox anyways…

Yogester

Thanks, that solves the refreshing part of the problem. Now if I can figure out how to have the browser polled to see if Tracks is already up in any of its tabs, and if so, to refresh that one…

Signature 

Tracks 1.042 on Locomotive / Camino 1.0.1

Profile
 
yogester
Posted: 18 July 2006 10:24 PM   [ Ignore ]   [ # 7 ]  
Newbie
Avatar
Rank
Total Posts:  5
Joined  2006-07-18

Thanks mate! I’ll try it tonight after I get a chance to delete the now offending record!

BTW, if you want Firefox to load the refresh inside the 1st window try

set theActiveURL to "http://0.0.0.0:3000/"
tell application "Firefox"
    
activate
    Get URL theActiveURL inside window 1
end tell 

Yogester

P.S. You need to have Firefox preferences set to “open links from other applications in most recent window”. One of the reasons I use Firefox just for TRACKS and Opera and Safari for all my other browsing needs.

Signature 

TRACKS Trunk served by Mongrel on a iMac G4 - accessed via Firefox and Treo650

Profile
 
yogester
Posted: 20 July 2006 07:18 PM   [ Ignore ]   [ # 8 ]  
Newbie
Avatar
Rank
Total Posts:  5
Joined  2006-07-18

I have played around with my applescript (again thanks to TRACKS I got to learn a new tech skill) but I didn’t like Firefox coming to the front when it refeshed after each QS action, so I modified it so that it will refresh in the background.

The script assumes that you have TRACKS open in window 1. Personally I use Firefox only for TRACKS so this is not a problem for me.

using terms from application "Quicksilver"
    
on process text ThisClipping
        
        
(* You need to edit these lines with your own info *)
        
set myUsername to "MYUSERID"
        
set myToken to "MYTOKEN"
        
        
set myContextID to 5
        
(* Almost done with stuff to edit. Change the url on the next line, too. *)
        
        
tell application "http://0.0.0.0:3000/backend/api"
            
set returnValue to call xmlrpc {method name:"NewTodo", parameters:{myUsername, myToken, myContextID, ThisClipping}}
        end tell
        tell application 
"Quicksilver"
            
show notification "Tracks" text "New item added to @calls"
        
end tell
        
        set theActiveURL to 
"http://0.0.0.0:3000/"
        
tell application "Firefox" to Get URL theActiveURL inside window 1
        
    end process text
end using terms from 
Signature 

TRACKS Trunk served by Mongrel on a iMac G4 - accessed via Firefox and Treo650

Profile
 
   
 
 
‹‹ Quick way to print feed?      Random Next Action ››

Powered By ExpressionEngine
Template Design By Sonnenvogel.com
Select a theme:

ExpressionEngine Discussion Forum - Version 2.1.2 (20091002)
Script Executed in 0.1289 seconds

Atom Feed
RSS 2.0