Scripting Dashboard

Is there a way to write a script that (a) “knows” if Dashboard is in overlay mode and if so, (b) abort script and present dialogue box that says, to continue, you must set Dashboard to spaces.

For years (sad but true), I’ve been trying to write a script that masks input of pdf pw and finally did it using the dashboard (pdf PW is inputted just as windows are pulled to the side when dashboard is in space mode - too fast for the eye to see).

Btw, if anyone out there would like to develop this last security piece as a paid job, please contact me - petersolon@petersolon.com. Thank you much

addendum
I’ve considered using the program Snaps Pro X as a different route - trying to mask pdf PW input behind a momentary screenshot of desktop - has anyone experience with this?

Here’s the entire script as it is now

display dialog “Your applications are about to quit. Save Your Work”
property keepList : {“Finder”, “AppleScript Editor”, “Adobe Reader”}
tell application “Adobe Acrobat Pro” to activate
tell application “System Events”
set visible of every process whose visible is false to true
set open_apps to name of every application process whose accepts high level events is true and visible is true
end tell
try
do shell script “ps cx|grep DashboardClient”
do shell script “killall Dock”
on error
tell application “Dashboard” to launch
end try
tell application “Finder”
open file 1 of folder (POSIX file “/Applications/ACIM” as text)
delay 0.1
end tell
set keyValue to “123456789012345678901234567890”
tell application “System Events” to keystroke keyValue
set keyValue to return
tell application “System Events” to keystroke keyValue
property keepListA : {“Finder”, “Adobe Reader”}
tell application “System Events”
set visible of every process whose visible is false to true
set open_apps to name of every application process whose accepts high level events is true and visible is true
end tell
delay 5
tell application “Dock” to quit
ignoring application responses
repeat with this_app in open_apps
end repeat
end ignoring