Multiple hazelExportTokens

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

Moderator: Mr_Noodle

Multiple hazelExportTokens Fri Mar 23, 2012 9:09 am • by vivekhurry
I'm trying to export two custom tokens from an external Applescript called by a Hazel rule, but there seems to be a bug here.

Basically, I'm trying to write a rule that automatically encrypts a PDF using a password that changes depending on the name of the file. My Applescript routine parses the filename (passed by Hazel), constructs the password and creates a new filename (basically adding '-p' at the end to signify that it's password-protected).

Now the Applescript runs fine and creates both the custom password and the new filename. However, when I try to export both, only 1 gets exported (I'm testing this via a call to a Growl notification in Hazel after my Applescript runs). I've defined two custom tokens in Hazel to match the two return values, called newpassword and newPDFName and the Growl notification uses both these tokens.

The Growl notification format is "newpassword - newPDFName"
If I use:
Code: Select all
return {hazelExportTokens:{newpassword:newpassword}}
the new password shows up in Growl
Code: Select all
return {hazelExportTokens:{newPDFName:newPDFName}}
the new file name shows up in Growl

(so the Applescript is working just fine; and, of course, the other token ain't there so Growl shows only 1 token)

Now, here's the strange part:
If I use:
Code: Select all
return {hazelExportTokens:{newpassword:newpassword, newPDFName:newPDFName}}
the new password shows up as both the newpassword AND the newPDFName in Growl (i.e., Growl shows both tokens but with the same value)

If I use:
Code: Select all
return {hazelExportTokens:{newPDFName:newPDFName, newpassword:newpassword}}
, i.e., flipping the order, the new PDFName shows up as both the newpassword AND the newPDFName in Growl

So, it seems that only one (the first) value is being passed through both tokens.

What gives? Any help appreciated!

(BTW, once the above starts working I plan to call a shell script with pdfauxinfo [url]msyk.net/macos/pdfauxinfo/[/url] to set the password on the PDF - I've used that in a stand-alone Applescript and it works peachy!)
vivekhurry
 
Posts: 4
Joined: Fri Mar 23, 2012 8:49 am

Re: Multiple hazelExportTokens Fri Mar 23, 2012 1:41 pm • by a_freyer
I can confirm this. Seems to be a bug.
Image
Image
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Multiple hazelExportTokens Fri Mar 23, 2012 1:45 pm • by a_freyer
I can confirm the same behavior for more than two custom tokens as well.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Multiple hazelExportTokens Fri Mar 23, 2012 2:18 pm • by Mr_Noodle
This is a known bug. I thought it was posted somewhere else here but in any case, it's fixed in test builds. If you want to try it, email support and I'll send you a link.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Multiple hazelExportTokens Fri Mar 23, 2012 2:55 pm • by vivekhurry
@a_freyer, @Mr_Noodle: Thanks for the confirmation! (Whew! Thought I was going batty or doing something stupid :roll: )

Have emailed support (via the site) as you suggested and will await the link.

Loving Hazel and the possibilities it offers!
vivekhurry
 
Posts: 4
Joined: Fri Mar 23, 2012 8:49 am


Return to Support