Skip to content

Instantly share code, notes, and snippets.

@zgracem
Created November 11, 2023 17:46
Show Gist options
  • Save zgracem/acae504040b5778e3f68da1f17039371 to your computer and use it in GitHub Desktop.
Save zgracem/acae504040b5778e3f68da1f17039371 to your computer and use it in GitHub Desktop.
AppleScript to add a layer of random noise to an Acorn document
set blankPixel to «data TPIC00000A0000000000000000000100010020280000000000»
tell application "Acorn"
tell front document
try
set the oldClipboard to (get the clipboard)
on error msg number -1700
set the oldClipboard to the blankPixel
end try
try
set the clipboard to the blankPixel
set the newLayer to paste
set the clipboard to the oldClipboard
on error e number i
set the clipboard to the oldClipboard
error e number i
end try
set the current layer to the newLayer
set the name of the newLayer to "noise"
set the blend mode of newLayer to soft light
set the opacity of newLayer to 0.25
set the seed to random number from 0 to 255
append filter name "TSRandomNoise" with parameters ¬
{inputGrayscale:1, inputSeed:seed}
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment