Bonjour,

Je suis novice en Applescript et j'ai bricolé un petit script que je veux utliser pour une performance artistique, il s'agit de produire des erreurs dans des fichiers d'image en y insérant du texte, ça marche plus ou moins...

Dans ce script donc l'image est modifiée par un morceau de texte, le morceau de texte (choisi aléatoirement) s'affiche. Ensuite je dois clicker sur ok dans la boite de dialogue puis et là je ne comprend pas pourquoi, je dois aller dans le dock et cliquer sur l'icone du finder pour que le script continu et m'affiche le résultat de l'image dans aperçu..

qqun a une idée?

voila le script :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
set MyImage to choose file --choisir un fichier d'image
set MyText to "/Users/damien/Documents/DATA_ME/textdam.txt" --choisir un fichier texte
 
set n to random number from 1 to 15
set m to random number from 2 to 150
tell application "TextEdit"
	open MyText
	tell document 1
		set Myline to paragraph n
		close
		open MyImage
		activate front window
		set paragraph m to Myline
		get Myline
		save
		close
	end tell
end tell
tell application "Finder" -- cette partie me sert à positionner mes fenêtre où je veux
	activate
	set c to (count windows)
	ignoring application responses
		display dialog Myline
	end ignoring
end tell
tell application "System Events"
	tell application process "Finder"
		repeat until ((count windows) > c)
			delay 0.5
		end repeat
		set position of window 1 to {1000, 22}
	end tell
end tell
tell application "Finder"
	activate
	open MyImage using application file "preview.app" of folder "Applications" of startup disk
	tell application process "Preview"
		set position of window 1 to {20, 22}
	end tell
 
 
 
 
 
 
 
end tell
merci pour votre aide

Damien