Page 1 of 1

Name of monitored folder as "inputAttributes" Applescript

PostPosted: Wed Jan 25, 2023 12:59 pm
by speedy_99
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.

Re: Name of monitored folder as "inputAttributes" Applescrip

PostPosted: Thu Jan 26, 2023 10:25 am
by Mr_Noodle
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.

Re: Name of monitored folder as "inputAttributes" Applescrip

PostPosted: Thu Jan 26, 2023 8:09 pm
by speedy_99
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.

Re: Name of monitored folder as "inputAttributes" Applescrip

PostPosted: Fri Jan 27, 2023 10:34 am
by Mr_Noodle
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.

Re: Name of monitored folder as "inputAttributes" Applescrip

PostPosted: Fri Jan 27, 2023 10:37 am
by speedy_99
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