Thanks, Arnaud, it works.

Here is what I coded :

f=LaunchServicesFindApplicationForInfoMBS("","com.apple.systemevents","")
       f.Launch False

       p=new ProcessMBS
       While p.Name<>"Événements système" ' Loop waiting for 
SystemEvents to be launched ("Événements système" in French)
         p.GetFirstProcess
         Do ' Loop checking if SystemEvents is running
           If p.Name="Événements système" Then exit
         Loop until not p.GetNextProcess
       Wend

       ae=new AppleEvent("prcs","kcod","com.apple.systemevents")
       ae.IntegerParam("----")=53
       call ae.Send

Thanks a lot.

Jean-Luc Arnaud

Le 10/09/2014 09:40, Marnaud a écrit :
> Le 9 sept. 2014 à 15:01, Jean-Luc Arnaud a écrit:
>
>> However, I would prefer to send directly an AE.
> Ok, I found the problem (at least, on my side). Here's what happens: 
> launching System Events brings it to the front (yes, it's a no-UI app, but it 
> can still be brought to the front (the menu bar, still showing the last app, 
> is all greyed out)).
>
> What about this, then? (note that there are two solutions; test one “or” the 
> other).
> f=LaunchServicesFindApplicationForInfoMBS("","com.apple.systemevents","")
> if f<>nil then
>    f.Launch false //Solution 1: don't try to activate SystemEvents
>    DelayMBS 3 //Here's the weak part: instead of waiting arbitrarily 3 
> seconds, we should loop until System Events is in the list of running 
> processes (on a slow computer, it may take more than 3 seconds).
>    app.FrontmostMBS=True //Solution 2: bring our app back to the front
> end if
>
> dim ae As AppleEvent
> ae=new AppleEvent("prcs","kcod","com.apple.systemevents")
> ae.IntegerParam("----")=53
> call ae.Send
>
> If it still doesn't work (I hope we had the same problem), could you describe 
> how it doesn't work for you? (the symptom)
>
> Hope this helps.
> _______________________________________________
> Mbsplugins_monkeybreadsoftware.info mailing list
> [email protected]
> https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info
>


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to