replace text doesn´t work with custom tokens

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

Moderator: Mr_Noodle

Hi,

I have a custom token "Operator" generated by this simple Applescript:
Code: Select all
return {hazelExportTokens:{Operator:do shell script "whoami"}}


It gives the shortname of the current user, e.g. "jpreussmann"
Now I want this token to be added to the original name of the triggered file,
but not the whole name but only the first two letters.
So I tried the tokens option "replace text".

Image

The tokens value is added to the name but without the text replacement.

Any ideas ?

Thanks,
Joerg
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Not sure about why the text replacement isn't working but if you are hardcoding the name in there anyways, why use a script and export token? Also, it might be better to shorten the name in the script.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Take it as an example.
It seems that the text replacement for script-exported tokens doesn´t work in general.
Could you verify this an your systems ?
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

CONFIRMED on my machine. Replacing text on modified token has no effect for me either. No log errors.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

I have some vague inkling that this may be by design though I don't recall what the reason was. I'll have to poke around in the code again to see if it comes back to me but for now, I think you should do any munging in the script itself.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

You may know this already, but the appropriate replace script for you would be:

Code: Select all
return {hazelExportTokens:{Operator:do shell script "whoami | sed 's/originaltext/replacementtext/g'"}}
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Text replacement for custom tokens within Hazel is not a must have, I found a lot of easy workarounds.
Your script could be one of them, thanks.
But I like to have Hazel processing as much as possible to reduce scripting to a minimum.
As for me Hazel is much easier to control than a script.
So it would be just nice if this broken text-replacement could be fixed.
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

Unless I can remember why I did it this way, I'll probably end up changing it in a future release. I need to keep better notes...
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Please fix this feature, as it is much needed by me too. I have 3.3.1 and this issue still exists. (Otherwise an excellent product.)
jimbo99
 
Posts: 2
Joined: Thu Nov 20, 2014 12:05 am

This feature is fixed. If it's not working for you, please provide more details.
Mr_Noodle
Site Admin
 
Posts: 11866
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

this didn't work for me with 3.3.1, it didn't save the replace text settings.
HOWEVER, just updated to 3.3.3 and it now WORKS!

Thanks, a great product.
jimbo99
 
Posts: 2
Joined: Thu Nov 20, 2014 12:05 am


Return to Support