Odd error behavior of script ("unknown error -43")

Hello,

first post, and immediately a likely stupid question…

The following script:


set {year:y, month:m} to (current date)
set filePath to "Macintosh HD:Users:hkarl:bin:timetray:rawtime:" & m & y

tell application "TextEdit"
	open filePath
end tell

is supposed to open a certain file in TextEdit, invoked from the drop-down list in the menubar.

It works nicely after booting, for a while. At some point (no structure yet apparent to me), it stops working, and the Finder shows two error dialog boxes:

1.) “Program not found”

and

2.) “Process could not be completed. Unknown error -43”

I am at quite a loss what to do here; would very much appreciate any ideas where to probe… (neither google nor forum search turned up anything I could make use of.)

thanks a lot and best regards,

Holger

Hi,

the month of a date is a constant, not a string. Maybe the implicit coercion to string causes the problem
try


set {year:y, month:m} to (current date)
try
	set filePath to alias ((path to home folder as text) & "bin:timetray:rawtime:" & (m as text) & y)
	tell application "TextEdit"
		open filePath
	end tell
on error e
	display dialog e
end try

Hi there,

that seems to help! Thanks, much appreciated!!!

(still odd that it works after startup, but then fails later on…)

best

Holger

PS: and thanks for improving style as well :slight_smile: