setting folder name based on date

folderdate()
on folderdate()
	set command to "date \"+%d.%m.%y\""
	set folderdate to do shell script command
	return folderdate
end folderdate

set n to folderdate
set folderm to ("AS " & (text 1 thru 6 of n) as text) & (text -1 of n) as text

this script works when run for the first time and then it start giving the error

help plz.

Hi,

to call a handler, you have to write the parentheses even there are no parameters to pass


on folderdate()
	set command to "date +%d.%m.%Y"
	set folderdate to do shell script command
	return folderdate
end folderdate

set n to folderdate()
set folderm to "AS " & (text 1 thru 6 of n) & (text -1 of n)

Note: there were too many useless as text coercions

the result is the same. it runs only once and then i get the same error.

the variable probably clashes with the handler’s name


on folderdate()
	return do shell script "date +%d.%m.%Y"
end folderdate

set n to folderdate()
set folderm to "AS " & (text 1 thru 6 of n) & (text -1 of n)

thanks, StefanK