admin管理员组文章数量:1023018
I have wrote code to make a bit faster introduce the time from promodoro in selfcontrol based on the intervals. However I couldn't introduce automatic, it just open the dialog to put the password. password input
tell application "WebPomodoro"
activate
end tell
set input to text returned of (display dialog "Ingresa un número para el Pomodoro:" default answer "" with icon note buttons {"Continue"} default button "Continue")
try
set inputNumber to (input as integer)
on error
display dialog "El texto ingresado no es un número válido."
end try
set total_time to 0
repeat with interval from 1 to inputNumber
set total_time to total_time + 25
if interval mod 4 = 0 then
set total_time to total_time + 25
else
set total_time to total_time + 5
end if
end repeat
set hours to (total_time div 60)
set minutes to (total_time mod 60)
display dialog (hours as string) & " horas y " & (minutes as string) & " minutos"
delay 2
tell application "SelfControl"
activate
end tell
delay 15 --set time
set myPassword to "password"
tell application "System Events"
-- Buscar el cuadro de diálogo de SelfControl
tell process "SelfControl"
keystroke myPassword
keystroke return
end tell
end tell
I have wrote code to make a bit faster introduce the time from promodoro in selfcontrol based on the intervals. However I couldn't introduce automatic, it just open the dialog to put the password. password input
tell application "WebPomodoro"
activate
end tell
set input to text returned of (display dialog "Ingresa un número para el Pomodoro:" default answer "" with icon note buttons {"Continue"} default button "Continue")
try
set inputNumber to (input as integer)
on error
display dialog "El texto ingresado no es un número válido."
end try
set total_time to 0
repeat with interval from 1 to inputNumber
set total_time to total_time + 25
if interval mod 4 = 0 then
set total_time to total_time + 25
else
set total_time to total_time + 5
end if
end repeat
set hours to (total_time div 60)
set minutes to (total_time mod 60)
display dialog (hours as string) & " horas y " & (minutes as string) & " minutos"
delay 2
tell application "SelfControl"
activate
end tell
delay 15 --set time
set myPassword to "password"
tell application "System Events"
-- Buscar el cuadro de diálogo de SelfControl
tell process "SelfControl"
keystroke myPassword
keystroke return
end tell
end tell
Share
Improve this question
asked Nov 19, 2024 at 0:18
RichardRichard
31 bronze badge
1 Answer
Reset to default 0No, for very good reason, you wouldn't want any random script to be able to just, grab your password, would you? In fact you wouldn't want the system to store your password for any reason any longer than it absolutely has to.
At least on my system however, as long as you have the password in AppleScript you can enter that into the password prompt.
Of course, you could just hardcode that password into the script, but that's not great for security, so you might want to store the password in the Keychain.
To do that, first you'll need to open 'Keychain Access', and hit Cmd+N to create a new entry. Enter something memorable in 'Keychain Item Name', you'll need it later, and enter anything into 'Account Name' (it doesn't matter). Enter your password into 'Password'.
Then you can try something like: do shell script "security find-generic-password -s 'name-of-keychain-entry' -w"
.
I have wrote code to make a bit faster introduce the time from promodoro in selfcontrol based on the intervals. However I couldn't introduce automatic, it just open the dialog to put the password. password input
tell application "WebPomodoro"
activate
end tell
set input to text returned of (display dialog "Ingresa un número para el Pomodoro:" default answer "" with icon note buttons {"Continue"} default button "Continue")
try
set inputNumber to (input as integer)
on error
display dialog "El texto ingresado no es un número válido."
end try
set total_time to 0
repeat with interval from 1 to inputNumber
set total_time to total_time + 25
if interval mod 4 = 0 then
set total_time to total_time + 25
else
set total_time to total_time + 5
end if
end repeat
set hours to (total_time div 60)
set minutes to (total_time mod 60)
display dialog (hours as string) & " horas y " & (minutes as string) & " minutos"
delay 2
tell application "SelfControl"
activate
end tell
delay 15 --set time
set myPassword to "password"
tell application "System Events"
-- Buscar el cuadro de diálogo de SelfControl
tell process "SelfControl"
keystroke myPassword
keystroke return
end tell
end tell
I have wrote code to make a bit faster introduce the time from promodoro in selfcontrol based on the intervals. However I couldn't introduce automatic, it just open the dialog to put the password. password input
tell application "WebPomodoro"
activate
end tell
set input to text returned of (display dialog "Ingresa un número para el Pomodoro:" default answer "" with icon note buttons {"Continue"} default button "Continue")
try
set inputNumber to (input as integer)
on error
display dialog "El texto ingresado no es un número válido."
end try
set total_time to 0
repeat with interval from 1 to inputNumber
set total_time to total_time + 25
if interval mod 4 = 0 then
set total_time to total_time + 25
else
set total_time to total_time + 5
end if
end repeat
set hours to (total_time div 60)
set minutes to (total_time mod 60)
display dialog (hours as string) & " horas y " & (minutes as string) & " minutos"
delay 2
tell application "SelfControl"
activate
end tell
delay 15 --set time
set myPassword to "password"
tell application "System Events"
-- Buscar el cuadro de diálogo de SelfControl
tell process "SelfControl"
keystroke myPassword
keystroke return
end tell
end tell
Share
Improve this question
asked Nov 19, 2024 at 0:18
RichardRichard
31 bronze badge
1 Answer
Reset to default 0No, for very good reason, you wouldn't want any random script to be able to just, grab your password, would you? In fact you wouldn't want the system to store your password for any reason any longer than it absolutely has to.
At least on my system however, as long as you have the password in AppleScript you can enter that into the password prompt.
Of course, you could just hardcode that password into the script, but that's not great for security, so you might want to store the password in the Keychain.
To do that, first you'll need to open 'Keychain Access', and hit Cmd+N to create a new entry. Enter something memorable in 'Keychain Item Name', you'll need it later, and enter anything into 'Account Name' (it doesn't matter). Enter your password into 'Password'.
Then you can try something like: do shell script "security find-generic-password -s 'name-of-keychain-entry' -w"
.
本文标签: shellIs there a way to automatic introduce the mac password using appleScriptStack Overflow
版权声明:本文标题:shell - Is there a way to automatic introduce the mac password using appleScript_ - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745588226a2157729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论