Applescript variable help

nim009

Registered
I am a total noob with applescripts,
I learned about how keystroke can type "stuff" if its put into quotes.
However I want to type a complex sentence involving the value of variable x.
like this: Nick is x years old
And I want this to be typed in something like TextEdit not the bottom dialog box in the script window.

I trid this but failed, and could not get further

tell application "System Events"
tell process "TextEdit"
set frontmost to true
end tell
set x to 20
keystroke "Nick is "
keystroke x
keystroke " years old"
end tell

How can I make this work?
any help would be really helpfull
 
I figured it out, its

set y to 20
set x to y as string
keystroke x

and that^ will work

but now I have another problem,
Neither worked:

keystroke esc
keystroke escape

so how do I do this?
 
key code 53
thats how I managed to type escape in applescript

I have almost finished writing my first large script,
but I still need to know one thing:
How do I select 2 or 3 Microsoft Excel charts at once with applescript?
(I used to just shift click to select 3 at once, but I have no idea how do do the equivalent of that with applescript)
I just need this one thing to finish.
Thanks to whoever helps.
 
Back
Top