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:
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:
where’s my mistake? (besides being a newbie in Applescript)
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:
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
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:
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