Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Ouvrir un fichier par Preview en applescript

2 réponses
Avatar
Saïd
Je voudrais faire afficher une image par Preview a partir d'un Apple
Script.

je fais:
osascript -e 'tell application
"Preview.app" to open "/Users/said/Pictures/motiv.jpeg"'

(le tout sur la meme ligne)

mais ca ne marche pas. Si preview n'est pas deja lancee, elle se lance mais
sans rien afficher. Sinon, ca ne fait strictement rien. Comme si open
voulait simplement dire "lance-toi".

Comment qu'on fait?

--
Saïd.

2 réponses

Avatar
Patrick Stadelmann
In article , Saïd
wrote:

Je voudrais faire afficher une image par Preview a partir d'un Apple
Script.

je fais:
osascript -e 'tell application
"Preview.app" to open "/Users/said/Pictures/motiv.jpeg"'

(le tout sur la meme ligne)

mais ca ne marche pas. Si preview n'est pas deja lancee, elle se lance mais
sans rien afficher. Sinon, ca ne fait strictement rien. Comme si open
voulait simplement dire "lance-toi".


Le paramètre de "open" doit être un type "file", "alias" ou un chemin de
type "HFS", mais pas POSIX. Pour convertir, il faut mettre "POSIX file"
devant le chemin :

... to open (POSIX file "..../.../.../motiv.jpeg")

Patrick
--
Patrick Stadelmann

Avatar
Saïd
Patrick Stadelmann :
In article , Saïd
wrote:

Je voudrais faire afficher une image par Preview a partir d'un Apple
Script.

je fais:
osascript -e 'tell application
"Preview.app" to open "/Users/said/Pictures/motiv.jpeg"'


... to open (POSIX file "..../.../.../motiv.jpeg")



Merci.

--
Saïd.