Thanks Arnaud,
Works great now.
Where can I learn about apple events? Any recommended books?
Thanks again.
Lennox.
Arnaud Nicolet <[EMAIL PROTECTED]> wrote: That means, as you probably figured
out, the System Events is not
running ;-)
You may try to insert that code:
dim f As FolderItem
f=SystemFolder.child("Library").child("CoreServices").child
("System Events.app")
if f<>nil and f.exists then
f.launch
end if
Le 19 févr. 07 à 21:48 Soir, Lennox Jacob a écrit:
> Thanks Arnaud,
> I used it but I keep getting the error message, ("System Events is
> not running. I don't know if that can happen.").
> I tried it with S (Save) instead of ; or : and still got the
> error message, any suggestions?
> Lennox.
>
>
> Arnaud Nicolet wrote: Ok, so you are about to use
> my second suggestion. And, in fact,
> that's great: you're apparently making an OS X-only thing (I said
> "great" because simulating a keyboard shortcut is different on every
> platform; it will save explanations (and I also don't know for
> Win32)).
>
> Ok, I just tried that:
>
> dim ae As AppleEvent
>
> ae=NewAppleEvent("prcs","kprs","sevs") 'Send a Keystroke event to
> System Events
> ae.StringParam("----")=":" 'The key to send
> ae.MacTypeParam("faal")="Kcmd" 'Use Command key
> if not ae.Send then
> MsgBox "System Events is not running. I don't know if that can
> happen."
> end if
>
> Well, in my tests, I used Command-S in a timer and switched to
> TextEdit. When the timer executed, a Save dialog appeared in
> TextEdit, that's it! Now, it should also work with ":".
>
> Hope this helps
>
> Le 19 févr. 07 à 13:27 Soir, Lennox Jacob a écrit:
>
>> Thanks Arnaud,
>> I do not own the menu item.
>> I just added CocoaSpellChecker and it is invoked via a menu item
>> which I do not own. The menuitem has two sub menuitem invoked via
>> Command-: and Command-;
>> I would like to invoke these two sub mernu items via seperate
>> pushbuttons.
>> Kindly advise.
>> Lennox.
>>
>> Arnaud Nicolet wrote: You have 2 ways of
>> achieving that.
>>
>> If you own the menu item, then you may move the code from the menu
>> handler to a new method. Then, instead of invoking Command and colon
>> in your code, you simply call the new method (you also call the new
>> method from the menu handler so that the menu item does not break).
>>
>> If you don't own the menu item or simply want to invoke a keyboard
>> shortcut, then you'll have to use a technique not built-in RB.
>> For instance, in MacOS X, you can invoke the "System Events"
>> application. It's an application made especially for AppleScript,
>> but, as you know, you can use AppleScript or Apple Events from RB.
>>
>> Which one are you trying?
>>
>> Le 19 févr. 07 à 04:18 Matin, Lennox Jacob a écrit:
>>
>>> Hello,
>>> I would like to code a pushbutton to effect a menuitem Command and
>>> colon, how can I do that?
>>> Thanks.
>>> Lennox
>>
>> _______________________________________________
>> Unsubscribe or switch delivery mode:
>>
>>
>> Search the archives:
>>
>>
>>
>>
>> ---------------------------------
>> Need Mail bonding?
>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>> _______________________________________________
>> Unsubscribe or switch delivery mode:
>>
>>
>> Search the archives:
>>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
>
>
> Search the archives:
>
>
>
>
> ---------------------------------
> Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
> _______________________________________________
> Unsubscribe or switch delivery mode:
>
>
> Search the archives:
>
_______________________________________________
Unsubscribe or switch delivery mode:
Search the archives:
---------------------------------
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>