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 |
Partager