I want to set uiscript keystroke to TextEntered… but i could not find a way…
display dialog "Set pause to:" default answer ""
copy result as list to {NumberEntered, ButtonPressed}
display dialog "Set text to:" default answer ""
copy result as list to {TextEntered, ButtonPressed}
delay NumberEntered
set uiScript to "keystroke \"hi
\""
run script "tell application \"System Events\"
" & uiScript & "
end tell"
Yeah, but if i want System Events to write TextEntered?
cause now it will only type what i set keystroke to…
can’t i set keystroke to textentered?
display dialog "Set pause to:" default answer ""
copy result as list to {NumberEntered, ButtonPressed}
display dialog "Set text to:" default answer ""
copy result as list to {TextEntered, ButtonPressed}
delay NumberEntered
set x to "keystroke \"
\""
run script "tell application \"System Events\"
" & x & "
end tell"
I tried it like that:
display dialog "Set pause to:" default answer ""
copy result as list to {NumberEntered, ButtonPressed}
display dialog "Set text to:" default answer ""
copy result as list to {TextEntered, ButtonPressed}
delay NumberEntered
run script ("tell application \"System Events\"
" & TextEntered as keystroke) & "
end tell"
it isn’t sufficient to tell System Events to do something,
you must tell an application process to perform the keystroke
The common syntax is
display dialog "Set pause to:" default answer ""
copy result as list to {NumberEntered, ButtonPressed}
display dialog "Set text to:" default answer ""
copy result as list to {TextEntered, ButtonPressed}
delay NumberEntered
activate application "whatever"
tell application "System Events"
tell process "whatever"
keystroke TextEntered
end tell
end tell
But i still have another question…
if i have a repeat loop and want to exit repeat if a certain button or button-combination is pressed,
how do i do that?