我编写了代码,以便根据间隔更快地在自控中引入 promodoro 的时间。但是我无法引入自动,它只是打开对话框来输入密码。密码输入
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