osx - Applescript only works once -


i still learning basics of applescript. when try run simple "hello world" script like:

tell application "textedit"     activate end tell tell application "system events"     keystroke "hello world!"     key code 36 end tell 

the first time run it, writes "hello world!" in textedit should. second time, writes "hello world!" in script editor. on, write in script editor.

am missing obvious in script? or there os x should looking at?

thanks in advance! feel free respond long winded answers, kbase articles, or other discussion threads may have missed.

tell application "textedit" activate tell application "system events"     tell application process "textedit" set frontmost true     keystroke "hello world!" & return end tell 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -