How to pass a variable from a embedded applescript to Hazel

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

Moderator: Mr_Noodle

Hi,

can anyone please explain me how i can pass a variable from an embedded applescript to Hazel!?

From Hazel to Applescript i use
Code: Select all
set theDate to item 1 of inputAttributes

which works perfect.

But from Applescript to Hazel i tried the following ones
Code: Select all
set outputAttributes to {"02.02.2000"}
set customAttributes to {"02.02.2000"}
set hazelOutputAttributes to {"02.02.2000"}
set hazelCustomAttributes to {"02.02.2000"}


Surely i add the name of the custom Attribute this script exports, but nothing works.

Can anyone please give me an advice.

Thanx in advance.
Thomas
t_klein
 
Posts: 20
Joined: Mon Feb 27, 2012 3:50 am

Search the help for "applescript". You need to return a record, not just set the variables.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi again,

OK - understood. No more lists but records. :oops:

But it tried every keyword again, like
Code: Select all
set hazeloutputAttributes to {myNewDate:"02.02.2002"}


Can you please give me an quick and dirty example!?

Kind Regards
Thomas
t_klein
 
Posts: 20
Joined: Mon Feb 27, 2012 3:50 am

You need to return a record as follows:
Code: Select all
    return { hazelOutputAttributes : {"02.02.2000"} }


That returns a record with the hazelOutputAttributes key and a value of a list with one item. In the UI, you need to specify the attribute which will contain that value and can be used in the rest of the rule.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr. Noodle you are my hero!

Thank you for your great and quick support! Now it works as it should. :lol:

Kind regards
Thomas
t_klein
 
Posts: 20
Joined: Mon Feb 27, 2012 3:50 am


Return to Support