Rename file: Donaim

Posted:
Sat Mar 09, 2013 11:23 am
by Cassady
Hello all,
Not having much luck at the moment!
Have set up rules to move any (file) placed on my desktop containing with words "screen shot" in the (name), into a folder called [Screen Shots].
This works as planned.
Typically I simply use Shft+Ctrl+3 off any website.
My problem:
I added a [rename] condition prior to the [move], with pattern [name] and [domain].
The latter does not appear to be working.
Adding any other variables like [date created] [extension] does as expected, but the space where the [domain] name is supposed to be placed, remains blank.
I tested this by moving things around - [ext] [name] [domain] vs [ext] [domain] [name] vs [domain] [name] [ext], and in all cases - only [ext] and [name] appear in the renamed filed, with nothing at [domain].
I've tried different websites, and different browsers. No difference is made.
Any suggestions?
Re: Rename file: Donaim

Posted:
Mon Mar 11, 2013 12:04 pm
by Mr_Noodle
Domain is only filled in by programs which receive files from other locations and even then, only a handful of programs do it (namely Safari and Mail). If you select the file in Finder and do "Get Info", you can see this information in the "Where froms". Screenshots are taken locally so there is no metadata filled in for this.
Re: Rename file: Donaim

Posted:
Mon Mar 11, 2013 12:46 pm
by Cassady
Mr_Noodle wrote:Domain is only filled in by programs which receive files from other locations and even then, only a handful of programs do it (namely Safari and Mail). If you select the file in Finder and do "Get Info", you can see this information in the "Where froms". Screenshots are taken locally so there is no metadata filled in for this.
Ah. Thanks for the explanation.
Re: Rename file: Donaim

Posted:
Mon Mar 11, 2013 5:53 pm
by a_freyer
if you give hazel a bit of time between screenshots, you can do this:
- Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
kind is image
name contains "Screen Shot"
Do the following to the matched file or folder:
run AppleScript (Embedded Script w/ Custom Token (• currentWebPage))
rename (customWebPage •)
...
The embedded script is:
- Code: Select all
tell application "Safari" to return {hazelExportTokens:{currentWebPage:URL of current tab of window 1}}
Make sure to add the Custom Token to the list as
currentWebPage
Re: Rename file: Donaim

Posted:
Thu Mar 28, 2013 4:30 am
by Cassady
a_freyer wrote:if you give hazel a bit of time between screenshots, you can do this:
- Code: Select all
if (all) of the following conditions are met for (the file or folder being processed):
kind is image
name contains "Screen Shot"
Do the following to the matched file or folder:
run AppleScript (Embedded Script w/ Custom Token (• currentWebPage))
rename (customWebPage •)
...
The embedded script is:
- Code: Select all
tell application "Safari" to return {hazelExportTokens:{currentWebPage:URL of current tab of window 1}}
Make sure to add the Custom Token to the list as
currentWebPage
Many thanks - this works a treat, but am I correct in that it would only function in Safari?
Tried replacing "Safari" with "Chrome" as the application in the script, and it picks up an error with my use of "current tab"...
Any thoughts?
Re: Rename file: Donaim

Posted:
Thu Mar 28, 2013 8:53 am
by a_freyer
Yes this is designed to work with safari. Look in the shrome AppleScript dictionary to get the current tabs source or domain.
For instance, this:
http://stackoverflow.com/questions/2483033/get-the-url-of-the-frontmost-tab-from-chrome-on-os-x