Newby needs help with character length....i think

Hi guys,

I’ve got a really basic script, which asks for job number and description. Basically i want the script to make a folder from the returned text, but also another folder, but this time only using the first 5 characters from the returned text. Not sure how to achieve this. Can anyone help.

Thanks

This is part of my script

tell application "Finder"
	set name_input to display dialog "Enter Job number and description" with icon 1 default answer ""
	set folder_name to text returned of name_input
	make new folder at desktop with properties {name:folder_name}
	make new folder at desktop with properties {name:folder_name} -- but only 5 characters in length???
end tell

Try something like this:

make new folder at desktop with properties {name:text 1 thru 5 of folder_name}

Bruce, Legend!!

Thanks:)

Can i now add a little something more?..

If this is now the current script:

tell application "Finder"
	set name_input to display dialog "Enter Job number and description" with icon 1 default answer ""
	set folder_name to text returned of name_input
	make new folder at desktop with properties {name:folder_name}
	make new folder at desktop with properties {name:text 1 thru 5 of folder_name}
end tell

Can i also add some static text to appear after the 5 character folder name which isn’t part of the returned text?

Thanks again

Try something like this:

make new folder at desktop with properties {name:(text 1 thru 5 of folder_name) & " Example"}

Thanks!! i was trying everything else but.

:slight_smile: