AppleScript Authentication Problem MacOS
Hello!
I have made a 'Troll' Application on AutoMator (MacOS Sierra) and will share it with my friends. At the end, I have it so that it asks the user to put their password in to stop the Application.
This is what I used:
on run
set the current_user to (get the long user name of (system info)) as string
set the input_password to the text returned of (display dialog "To Stop NOT_A_VIRUS.exe, Please enter the password for " & the current_user & ":" default answer "" buttons {"OK"} default button 1 with icon caution with hidden answer)
try
do shell script "history -c" user name the current_user password the input_password with administrator privileges
on error
display dialog "Wrong Password!" buttons {"Resume NOT_A_VIRUS.exe"} with icon caution
end try
set myProcesses to {"NOT_A_VIRUS"} -- The ones to quit.
tell application "System Events"
repeat with myProcess in myProcesses
set theID to (unix id of processes whose name is myProcess)
try
do shell script "kill -9 " & theID
end try
end repeat
end tell
display dialog "Successfully Quitted NOT_A_VIRUS.exe" buttons {"OK"}
end run
When the user enters their password incorrectly, it says say "Wrong Password!" with a button that says "Resume NOT_A_VIRUS.exe"
When you press the button, it should only resume the App, but it also says Successfully Quitted NOT_A_VIRUS.exe.
Its kind of hard to explain, but if you do understand, please help.
-Regards
13 Year Old Coder
最後更新:2017-09-23 17:31:36
上一篇:
White screen after loading video app in IOS 11
下一篇:
ios10 compatible with os4 ?
MacBook Air Heating Solution
error 13010 will not allow me to open iTunes?
Can I choose not to use the cellular even if I ...
How to cut out a portion of a region and then x...
sync photos to iPhone not working?
How do I see my podcast library in iTunes 12.7
On my macbook pro Sierra Osx I cannot sign into...
Do Apple still support 3generation ipod
I got a Minor scrach/break on my apple watch se...
How can I cancel the order for iphone
相關內容
"com.apple.installer.pagecontroller error
any idea what error 3503 is?
Underallocation Detected on Main device
The operation couldn’t be completed. (BKA...
is ctoid.exe a virus on my ipad safari browser?
iTunes Error: Declined to authorize this image ...
Keep High Efficiency Original if Available Chec...
iTunes 12.7 cannot edit playlist
High Sierra Stuck & Decryption paused
Need to unlock iphone 5 to reactivate the phone...
熱門內容
Christian Music Removed From Itunes
I'm being billed twice every month for Apple Mu...
iMac running slow
Fix disappearing album art after moving iTunes
Activation Locked iWatch
Can I change the iwatch to miles instead of kil...
I keep seeing the "You don't have permission to...
can't read any menus macbook air
iPad 2, iOs9.3, taking days to restore
charges made under itune memeberships