CompuServe Thread

#AppleScript basics

2 messages in this thread
#163922From: Joe SewellMar 14, 1994 5:02 PM
John, Hmmm … so sending an AE (is that better? 🙂 ) to yourself is different than having another app send it to you? Interesting. I wonder if that could get you in trouble, say if you were expecting it to go through the event queue. –> It is also easy to send an event (with the don't execute flag, usually) which creates a comment in the recorded script. <– Oh yeah? What happens in the recorded script? Does it get translated as it normally would, but with a comment mark before it? (I don't have the source to a recordable app handy, so I can't just try this myself. 🙂 ) Joe
#163971From: John BaxterMar 14, 1994 9:54 PM
Joe, In the recorded script, you get a comment (a full line comment). For example (helping CIS along with the left chevron, as usual: on JoeS () with objectModel, ToyStore bringToFront () << "New" menu command. appleEvent (id, 'app1', 'nwin', '—-', "") JWB comment: I seem to including a trailing <return>. I didn't remember including that… Here's the AppleScript version of the same operation (in both cases, switching an already-running ToyStore to the front, and selecting the New command from the File menu: tell application "ToyStore" activate (*"\"New\" menu command."*) New Window "" end tell JWB comment: hmmm…I think I'll use typographic quotes next time. I'm not sure where the blank line is coming from, using the "Copy Selected Script" menu command on the Frontier version. There doesn't seem to be a return above (and, there isn't a blank line in the Frontier script editor window The C source won't mean much, although you can make a good guess based on the function names RecordOnlyString (kASAppleScriptSuite, kASComment, "\p\"New\" menu command."); return (RecordableString (app1class, 'nwin', "\p")); No return character in there. Actually, I believe an app can send an event to itself either in the special way mentioned above (which is the way that gets things recorded, or via the event queue. If the target address is a typePSN with the special value kCurrentProcess, you get the direct dispatch form. I haven't had reason to try to induce the AE Manager to do a slow self send via the event queue. A typeSignature target address would probably do the trick. "I wonder if that could get you in trouble, say if you were expecting it to go through the event queue." Probably only once per developer. –John