Name of monitored folder as "inputAttributes" Applescript

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I need your help, because I have not found a solution despite searching the forum and the Internet. I'm on the line there.

The following should happen:

If in the monitored folder (or subfolder) a file stays longer than X days, the name, not the path, of the folder should be passed to Applescript as "inputAttributes".

Getting the name is my problem.

If this does not work with the monitored folder, I could put the file in a subfolder.
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm

You should be able to get the name using the path (the reverse isn't true though). A google search brings up several answers to how to achieve that. It's not Hazel-specific. Not sure why you would need that sent separately.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You should be able to get the name using the path (the reverse isn't true though). A google search brings up several answers to how to achieve that. It's not Hazel-specific. Not sure why you would need that sent separately.


Hi,

there are 2 reasons or requirements:

1.) I would like to use the folder name elsewhere. A special medical software stores relevant data in a part of the folder name, which I would like to reuse.

2) I don't know how to convert the possix path to the Windows SMB path.
"file:///\\\\Server\\Folder\\Subfolder\\File.pdf"
This is needed so that you can open a file directly from a link in Outlook for Windows, for example.

Since only the subfolder name is variable, this is an admittedly primitive workaround, for lack of better knowledge, to implement both requirements.

I am open for better ways and grateful.
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm

You do know the monitored folder ahead of time, so you could just hardcode that into the AppleScript. As for converting to an smb path, you'll need to do some text manipulation of the path. Again, this isn't Hazel-specific so searching around on more general AppleScript sites should turn up something.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You do know the monitored folder ahead of time, so you could just hardcode that into the AppleScript. As for converting to an smb path, you'll need to do some text manipulation of the path. Again, this isn't Hazel-specific so searching around on more general AppleScript sites should turn up something.



Thanks, I will look on AS sides
speedy_99
 
Posts: 56
Joined: Thu Feb 12, 2015 11:00 pm


Return to Support