Results 1 to 5 of 5

Thread: AppleScript and Tags

  1. #1
    New Member
    Join Date
    Feb 2009
    Posts
    2

    Default AppleScript and Tags

    Hello,

    I'm trying to use the Reload Web Pages script on a few records only (vs all of them). I tagged these records in my library with a tag named "autorefresh" and attempted to retrieve them using the following script:
    Code:
    tell application "EagleFiler"
    	set _tagname to "autorefresh"
    	set _records to displayed records of browser window 1
    	set _tags to tags of library document 1
    	
    	-- looking for "autorefresh" tag
    	set found to false
    	repeat with _tag in _tags
    		if _tag's name is _tagname then
    			set found to true
    			exit repeat
    		end if
    	end repeat
    	
    	if found then
    		-- looking for the records with this tag
    		repeat with _record in _records
    			if the assigned tags of _record contains {_tag} then
    				beep
    				-- reloadWebPage(_record)
    			end if
    		end repeat
    	end if
    end tell
    At least one record with the "autorefresh" tag exists, but no beep is produced (note: my Mac's audio output works fine :).

    My questions:
    1. where's my mistake? (besides being a newbie in Applescript)
    2. is there a better way to do it?

    Thanks in advance!
    Arsene

  2. #2

    Default

    I’m not entirely sure why your way didn’t work. I think it’s something to do with _tag being a specifier (the i-th tag of _tags) rather than an actual tag. When I write it like this, it seems to work:
    Code:
    tell application "EagleFiler"
        set _tagname to "autorefresh"
        set _records to displayed records of browser window 1
        try
            set _tag to tag _tagname of library document 1
        on error
            return
        end try
        repeat with _record in _records
            if the assigned tags of _record contains {_tag} then
                beep
                -- reloadWebPage(_record)
            end if
        end repeat
    end tell

  3. #3
    New Member
    Join Date
    Feb 2009
    Posts
    2

    Default Periodical script and "search" in Applescript

    It works indeed! Thanks for such a quick reply!

    Two more questions:
    My first idea was to trigger the script every now and then using Hazel on a dummy folder. Is there something less intricated to run periodically a script?

    Would it be interesting to add a "search" command to the EagleFiler dictionary?
    My problem would have been solved in a breeze:
    Code:
    tell application "EagleFiler"
    	tell browser window 1
    		search with query {"autorefresh"} in field {tags} 
    		repeat with _record in selected records of browser window 1
    			my reloadWebPages(_record)
    		end repeat
    	end tell
    end tell
    Thanks again!
    Arsene

  4. #4

    Default

    Quote Originally Posted by Arsene View Post
    My first idea was to trigger the script every now and then using Hazel on a dummy folder. Is there something less intricated to run periodically a script?
    You could use cron or iCal, which ship with Mac OS X. There are also various utilities such as iDo Script Scheduler and Script Timer.

    Quote Originally Posted by Arsene View Post
    Would it be interesting to add a "search" command to the EagleFiler dictionary?
    Yes, that’s something I’m working on.

  5. #5

    Default

    EagleFiler 1.4.5 adds the “assigned tag names” property, which should make it easier to write this type of script.

Similar Threads

  1. Import Tags from Tagit or Tags Application
    By frank in forum EagleFiler
    Replies: 2
    Last Post: 03-24-2009, 04:10 PM
  2. Nested Tags, Tags and Folders
    By erooke in forum EagleFiler
    Replies: 3
    Last Post: 10-16-2008, 06:11 PM
  3. Need help with Firefox AppleScript
    By nipon in forum EagleFiler
    Replies: 1
    Last Post: 11-01-2007, 03:38 PM
  4. Hierarchical tags: viewing all elements with children tags
    By George the Flea in forum EagleFiler
    Replies: 1
    Last Post: 10-17-2007, 11:23 AM
  5. Applescript syntax
    By wjshack in forum EagleFiler
    Replies: 5
    Last Post: 01-29-2007, 11:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •