which one of two solution is faster

21 views
Skip to first unread message

Kalman Tarr

unread,
3:29 AM (14 hours ago) 3:29 AM
to QLab
Hi pros,

I wrote a script, I set min time between each GO command. 
I show you two solution and ask, which one solution of  is faster? 
I am using handlers to solve this.

first one:

to setMinTime()

# network row 

try

tell application "System Events" to tell application process "QLab" to tell (first window whose description contains "settings") to tell (first row of table 1 of scroll area 1 whose accessibility description of UI element 1 is "General") to select

end try

tell application "System Events" to tell application process "QLab" to tell (first window whose description contains "settings") to tell (first row of table 1 of scroll area 1 whose accessibility description of UI element 1 is "network") to tell application "System Events" to tell application process "QLab" to tell button 1 of window 1 to click

tell application "System Events" to tell application process "QLab" to set focused of text field 3 of window 1 to true

tell application "System Events" to tell application process "QLab" to set value of text field 3 of window 1 to (timeBetweenGo as text)

tell application "System Events" to tell application process "QLab" to perform action "AXConfirm"

end setMinTime



second one:

to setMinTime()

# network sor kiválasztása and 

try

tell application "System Events" to tell application process "QLab" to tell (first window whose description contains "settings") to tell (first row of table 1 of scroll area 1 whose accessibility description of UI element 1 is "General") to select

end try

# Set minTime between eachGo

tell application "System Events" to tell application process "QLab"

set focused of text field 3 of window 1 to true

set value of text field 3 of window 1 to (timeBetweenGo as text)

perform action "AXConfirm"

end tell

end setMinTime


I await your response, thank you in advance.
Best,
Kalman

Rich Walsh

unread,
10:09 AM (7 hours ago) 10:09 AM
to ql...@googlegroups.com
You could just do this:

set timeBetweenGo to 15

do shell script "echo '/settings/general/minGoTime " & timeBetweenGo & "' | nc -4 -u -w 0 localhost 53535"


I don’t really understand the question: your first script has 5 events, the second has only 4. It’s hard to say if the missing one is needed, or has a measurable effect on speed. Script Debugger will time things for you if it matters that much. 

Neither script seems to work anyway – perhaps you need more context and setup to get the right thing showing in the UI? The difference in the Events tab of the Result in Script Editor is between…

tell application "System Events"

select row 1 of table 1 of scroll area 1 of window 1 of application process "QLab" whose description contains "settings" whose accessibility description of UI element 1 = "General"

click button 1 of window 1 of application process "QLab"

set focused of text field 3 of window 1 of application process "QLab" to true

set value of text field 3 of window 1 of application process "QLab" to "10"

perform action "AXConfirm" of application process "QLab"

end tell


…and…

tell application "System Events"

select row 1 of table 1 of scroll area 1 of window 1 of application process "QLab" whose description contains "settings" whose accessibility description of UI element 1 = "General"

set focused of text field 3 of window 1 of application process "QLab" to true

set value of text field 3 of window 1 of application process "QLab" to "10"

perform action "AXConfirm" of application process "QLab"

end tell


It doesn’t matter how you wrap the events up in blocks, this is what’s actually happening.

(I’m guessing you are declaring timeBetweenGo as a global variable? I’d have passed it directly to the subroutine – setMinTime(theTime), etc.)

Rich
Reply all
Reply to author
Forward
0 new messages