Please help with this Applescript. Thanks in advance!

Discussion in 'Mac Programming' started by r1ngx, Dec 13, 2012.

  1. r1ngx, Dec 13, 2012
    Last edited by a moderator: Dec 14, 2012

    macrumors newbie

    Joined:
    Oct 25, 2010
    #1
    I would like to adapt the following NewsRack plug-in applescript to save the .html that is generated to a directory on the hd. Thanks in advance for any help.

    Code:
    tell application "NewsRack"
    	set article_url to url of selected tab
    	if article_url is "" then
    		display dialog "No article selected." buttons {"OK"}
    		return
    	end if
    	if article_url starts with "http://www.instapaper.com/m?" then
    		return -- we are already on an Instapaper page
    	end if
    	
    	set encoded_url to escape article_url
    	set instapaper_url to "http://instapaper.com/m?u=" & encoded_url
    	
    	if kind of selected tab is "news" then
    		do JavaScript "document.location.href = '" & instapaper_url & "'"
    	else
    		set url of selected tab to instapaper_url
    	end if
    end tell
     

Share This Page