1

I don't know much about how Mac processes keystrokes, but if I wrote a simple AppleScript that opened a TextEdit document and started typing a huge block of text, would this effectively mask my typing if it ran in the background?

Or does Mac process the AppleScript keystroke input first then whatever I'm typing second?

0

Using a test KeyDownEvent app.

The keystrokes are registered from an applescript keystroke event.

But I do not think you will be able to use this as a mask.

The Applescript keystrokes will always insert the characters in the active app. Therefore typing in the area you are manually trying to type.

So if you had a block of text like :

"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"

This also registers like this in the logger. So as you can see not really hiding much.

The keystrokes in the Applescript are fast and sent in a block.

Another thing to note is my test app had to be given permission to control my Computer before it was apple to log events.


UPDATE*

You can do as @Tetsujin suggested and wait until the the Applescript starts typing in the first app and then you switch to another app to manual type.

You would need to use two tell blocks in the Applescript.

 tell application "System Events"
        delay 5
     tell application process "TextEdit" -- the app typing target
            keystroke "aaaa...."
     end tell
    end tell

But as I said the keystrokes are sent in what in effect is a block.

So regardless of where it is being typed the logger will pick it up as the same above.


1

Well, it might kind of work, but idk if it would do what you want to achieve.

This script

tell application "TextEdit"
    activate
    make new document
    delay 1
    repeat 100 times
        tell application "System Events"
            keystroke "the quick brown fox jumps over the lazy dog"
            keystroke return
        end tell
    end repeat
end tell

will start typing into whichever document is frontmost when it starts after the 1s delay time for TextEdit to come to the front.
Once it's typing, you can switch to another app & continue what you were doing - but you can't use TextEdit as it won't let any other document come to the front until it's finished.

If you switch to another app before it starts typing, it will type into that instead.

Whether that would fool a key logger, I have no clue - but that begs the question…
what makes you think you have a key logger & why not get rid of it instead?

If it's some kind of 'corporate' checkup on employees, consider how long it might take before they noticed it & wondered why you felt it necessary to try to bypass - something presumably covered in a contract of employment.

0

So I've learned that:

– Apple processes keystrokes in blocks

– These keystrokes are application specific

The following script was my attempt at this(I have shortened the "keystroke" to three lines for succinctness, if anyone wants to see the full, unedited code, let me know):

tell application "TextEdit"
activate
make new document
delay 0.1

repeat 2 times
    tell application "System Events" to keystroke "
(((((((((((((((((((((((((((((((((((((((((((((((((((ˇ¬ˇƒˇƒˇ⁄≤Ä9_X 
퀩‹∑A`ñ˜rZ∏(–9flo-ˇ˙ Êªhô˘Ûfi—>ngsú∏∂}πõ§œø g8µ(lì°}‡∫êä…>≠Çä⁄ÀÍÉ{µ»éÀX[ö
˛Ä¢˙Gö˙<É@g0í5—<Ì”§KùëLøYbb÷¶<√zEeö§Ô ¶‡6†≥ߢª¨zK‰Á+Ü[˙4[—ŒΩÚsu≈0˝9…"

end repeat

end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .