Converting folder to integer?

The following code produces the error message “Can’t make “TestGen.fol:Contents:MacOS:TestGen” into a integer.”

tell application "Finder"
	
	set ProgramFolder to container of file (path to me)
	set TempFolder to (ProgramFolder as string) & "Update Items:"
	
	if exists (file "TestGen.fol:Contents:MacOS:TestGen" of folder TempFolder) then
		move (file "TestGen.fol:Contents:MacOS:TestGen" of TempFolder) to (folder "testgen.app:Contents:MacOS" of ProgramFolder) with replacing
	end if
end tell

All the files/folders that are referenced here exist. What the heck is going on?

With 10.3, when a script is run the Script Editor, path to me returns the path to the folder containing Script Editor.

set testPath to (path to me) as string
testpath

returns Gig:Applications:Applescript:Script Editor.app on my machine. However, saved as an application then double clicking on it, the same script returns the path to the script.

There needs to be a delimiter “:” before ‘Update Items". Using your style, there also needs to be the reference to the folder object in the from parameter of’move’

The ‘container of’ reference could be used this way


tell application "Finder"
   set ProgramFolder to container of file (path to me)
   set TempFolder to (ProgramFolder's name & ":Update Items:")
   if exists (file "TestGen.fol:Contents:MacOS:TestGen" of folder TempFolder) then
      move (file "TestGen.fol:Contents:MacOS:TestGen" of folder TempFolder) to

Save as an application.
HTH
Craig