Random File Name Generation with Applescript

Hi All.
New to hazel but really enjoying it so far.
This is what I'm trying to do:
Run and embedded applescript that generate a random string so I can pass it as a token and use to rename files.
The applescript code I have is as follows:
This code works as I use it in TextExpander all of the time. Returns a 12 character random string. I'm having issues working this into Hazel. I don't have any AppleScript Experience.
This is what I have but I know there is an issue with the end portion where it passes the token:
Can anyone help?
New to hazel but really enjoying it so far.
This is what I'm trying to do:
Run and embedded applescript that generate a random string so I can pass it as a token and use to rename files.
The applescript code I have is as follows:
- Code: Select all
set str to {}
set end of str to some item of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
repeat 12 times
set end of str to some item of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_+-=[]>?;:'"
end repeat
return (str as string)
This code works as I use it in TextExpander all of the time. Returns a 12 character random string. I'm having issues working this into Hazel. I don't have any AppleScript Experience.
This is what I have but I know there is an issue with the end portion where it passes the token:
- Code: Select all
set str to {}
set end of str to some item of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
repeat 12 times
set end of str to some item of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_+-=[]>?;:'"
end repeat
return (str as string)
return {hazelExportTokens:{randomname:str}}
Can anyone help?