Taking filename into URL

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Taking filename into URL Fri May 03, 2013 12:16 pm • by gibboireland
Hi guys,

Would sincerely appreciate your help with this please. Very simply I am just looking to get the filename and enter it into a pre-formatted URL. (Background to ask is that URL contains an api for a push notification to my mobile).

So essentially looking after normal processing of filename.doc, I would like it to open my browser and append the filename into the URL where I need it e.g. www.myurl-filename-testofurl.com

After playing for hours with custom tokens to no avail, I just cant get the filename to transfer over into the url for me.

Thanks so much for any guidance!
Brian
gibboireland
 
Posts: 2
Joined: Fri May 03, 2013 12:11 pm

Re: Taking filename into URL Mon May 06, 2013 12:26 pm • by Mr_Noodle
You'll need to use a script for this as there's no built-in action to connect to a browser and send it an URL.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Taking filename into URL Mon May 06, 2013 1:29 pm • by gibboireland
Thank you for the response. Yes I have managed to get it via appescript to open my browser at my designated URL. However, I havent been able to get via a script the filename to go into a specific place within my url: www.myurl.com/FILENAMEHERE/index.aspx

I know the answer is with the use of custom tokens, but I can barely code Hello World - frankly I dont know what Im doing despite following every guide on custom tokens I can find.

Thanks in advance for any help!

(In case anyone is wondering why I want this - there is a service for Windows Phone, that allows you via an api based URL to send notifications to your phone. Im hoping via this script I can have Hazel execute the url, allowing me to receive on my phone a notification that it has completed)
gibboireland
 
Posts: 2
Joined: Fri May 03, 2013 12:11 pm

Re: Taking filename into URL Mon May 06, 2013 3:57 pm • by Mr_Noodle
BTW, I neglected to notice this before but please do not post questions in the Tips forum. The sticky article up top indicates you shouldn't do this.

You don't need custom tokens if you are just using the filename. You get a file alias which you can translate into a path and then grab the filename out of that.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Open Discussion