Qual è la differenza tra "attivare" e "lanciare"?

7

Ecco un esempio di codice di Applescript:

do shell script "osascript -e 'tell application \"Safari\" to activate'"

do shell script "osascript -e 'tell application \"Safari\" to launch'"

C'è qualche differenza nel comportamento di questi due comandi?

Perché, ai miei occhi, sembra che abbiano esattamente lo stesso effetto.

    
posta rubik's sphere 04.02.2017 - 15:37
fonte

1 risposta

6

Dalla guida alla lingua di AppleScript:

activate Brings an application to the front, launching it if necessary.

launch Launches an application, if it is not already running, but does not send it a run command.

If an application is already running, sending it a launch command has no effect. That allows you to open an application without performing its usual startup procedures, such as opening a new window or, in the case of a script application, running its script. For example, you can use the launch command when you don’t want an application to open and close visibly. This is less useful in AppleScript 2.0, which launches applications as hidden by default (even with the run command).

    
risposta data 04.02.2017 - 16:22
fonte

Leggi altre domande sui tag