Created
April 6, 2019 12:20
-
-
Save mpepping/af304a276fdc9148efb90a4510cceccb to your computer and use it in GitHub Desktop.
AppleScript to copy a Safenet MobilePASS OTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- AppleScript to copy a Safenet MobilePASS OTP. | |
-- | |
-- 'osascript ~/path/to/token.applescript' | |
-- Set 'passwd' to your MobilePASS passcode. | |
set passwd to "0000" | |
-- Start MobilePASS | |
tell application "MobilePASS" | |
activate | |
delay 1 | |
end tell | |
-- Copy token | |
tell application "System Events" | |
tell table 1 of scroll area 1 of window "MobilePASS" of application process "MobilePASS" | |
delay 1 | |
select row 1 | |
end tell | |
keystroke passwd | |
delay 1 | |
set uiScript to click UI element "Copy Passcode" of window "MobilePASS" of application process "MobilePASS" | |
end tell | |
-- Quit MobilePASS | |
tell application "MobilePASS" | |
quit | |
end tell |
@cloudmustafa posted a small update to the script of my previous comment. Maybe it useful ..
Outstanding! Thanks for sharing!!
thanks @mpepping !
I improved this a little further for an even faster approach :-)
takes not even one second now.
(for example by using set value of text field to passwd
instead of keystroke passwd
)
-- AppleScript to copy a Safenet MobilePASS OTP.
--
-- 'osascript ~/path/to/token.applescript'
-- Set 'passwd' to your MobilePASS passcode.
set passwd to "0000"
-- Make sure MobilePASS is not running
tell application "MobilePASS"
quit
delay 0.2
end tell
-- Start MobilePASS
tell application "MobilePASS" to activate
-- Copy token
tell application "System Events"
tell window "MobilePASS" of application process "MobilePASS"
-- Select the first item in the list
tell table 1 of scroll area 1 to select row 1
-- Fill the input field with the value from the passwd variable
set value of text field 1 to "4321"
-- Copy the passcode
set uiScript to click UI element "Copy Passcode"
end tell
end tell
-- Quit MobilePASS
tell application "MobilePASS" to quit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!! It works!!!!!