applescript - to save applescript - to be read by another applescript

i have a script repeat-running on one machine & a script repeat-running on another
& I need to pass a record between them

i thought i could do something like this

set recy to {pooColour:"", consistency:""}
set pooColour of recy to "burnt sienna"
set consistency of recy to "squidgy"

set file_name to "TestScript001.scpt"
set folder_path to path to desktop folder as Unicode text

tell application "Finder"
	try
		set departDoc to open for access file (folder_path & file_name) with write permission
		write recy to departDoc
		close access departDoc
	on error
		close access departDoc
	end try
end tell

pulling in with this sort of thing


set PulledInSpex to (run script file (folder_path & file_name))

doesnt see it as a script?!?!?

then i tried this


set recy to {pooColour:"", consistency:""}
set pooColour of recy to "burnt sienna"
set consistency of recy to "squidgy"

script toFloatOver
	-- how do i get this in here??
	recy
end script

set file_name to "TestScript002.app"
set folder_path to path to desktop folder as Unicode text
store script toFloatOver in file (folder_path & file_name)

with this to read it in/pick it up


run script file (folder_path & file_name)

that is a script - but of course i cant figure ou how to get the record into the script

books i have dont seem to help
can you be the one to help please :wink:

On my laptop I had this:

set myRec to {Fname:"Adam", Lname:"Bell"}
set DT to (path to desktop folder) as Unicode text

set F to open for access (DT & "myRec.txt") with write permission
try
	set eof of F to 0
	write myRec to F as record
	close access F
on error
	close access F
end try

On my G5 machine, with the laptop machine shared on the desktop

set tRec to alias "adambell:Desktop:myRec.txt"
set importR to read tRec as record --> {fname:"Adam", lname:"Bell"}

easy when you know how :smiley:
thanks muchly Adam Bell
you may have just saved Christmas

  • really looks like i was driving (for hours) down the wrong highway

When you’ve the time, read this tutorial by Nigel Garvey: The Ins & Outs of File Read/Write in AppleScript

Thanks Adam for the link, good info. Below is a quick reference for others to the new path. It doesn’t have bbs.macscripter…

http://macscripter.net/viewtopic.php?id=24745