OK, so I have this script which, if the rules are met, will open a script, which has a dialog box with a text box inside it. How do I tell it to set the contents of that text box to something… I tried
run script ("Myscript.scpt" as alias)
set contents of front window to some_text
but that doesn’t work 
Model: MacBook Pro
AppleScript: 2.21
Browser: Google Chrome 5.0.307.9
Operating System: Mac OS X (10.6)
Calling script
set scriptPath to load script file "pathtoscript"
scriptPath's displayDialog("Hi There")
Called script
on displayDialog(theText)
display dialog theText default answer theText
end displayDialog
That has to do with how myScript is written.
myScript has to return the text entered by the user
This is an example of how myScript might be written. Note that the user pressing Cancel is handeled by the script rather than by letting AppleScript just end.
-- possible myScript
try
return text returned of (display dialog "Enter something" default answer "")
on error
return "canceled"
end try
That script could be called by a routine that looks something like
set returnedText to run script ("Macintosh HD:Users:merickson:Desktop:myScript.scpt" as alias)
if returnedText ≠"canceled" then
set text of document 1 of application "TextEdit" to returnedText
end if
I’ve got script 1. Script 1 launches script 2 which displays a dialog box with a text box in it. I want Script 1 to type something in that text box.
That is exactly what my example demonstrates.
Sorry, I got a bit muddled up…