on idle theObject
if init_run then
display dialog "not inside idlehandler" & init_run -- true
else
display dialog "inside idlehandler" & init_run --false
end idle
on clicked theObject
set init_run to false
idle
end clicked
problem: after pressing a button the display dialog “inside idlehandler” is working fine - it will be displayed “false” but the other
routines in my “onIdle” handler will not be displayed…
this is really weird - I have entered some “display dialogs” and found out that the
idle is running through - but no output will be displayed - and the return 1 has no effect,
because the dialogs are only presented 1 time…
on idle theObject
if init_run then
display dialog "nicht drinnen" & init_run
else
display dialog "drinnen" & init_run
--display dialog "drinnen"
--Anzeige Onlinezeit
tell application "Internet Connect"
set time_conn to seconds connected of status as string
end tell
display dialog "here"
set numSeconds to time_conn mod 60
set temp to time_conn - numSeconds
set numMinutes to temp div 60
set numMinutes to numMinutes mod 60
set temp to (numMinutes * 60) + numSeconds
set temp to time_conn - temp
set numHours to temp div 3600
if numHours < 10 then set numHours to "0" & numHours
if numMinutes < 10 then set numMinutes to "0" & numMinutes
set finalTime to numHours & ":" & numMinutes & ":" & numSeconds as string
-- Statusanzeige (Internet)
tell application "Internet Connect"
set con_status to state of status as string
end tell
if con_status is "0" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 1
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to true
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to false
else if con_status is "2" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 2
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to false
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to true
else if con_status is "4" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 3
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to false
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to true
else if con_status is "7" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 4
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to false
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to true
else if con_status is "8" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 5
set contents of text field "print_time" of tab view item "Setting" of tab view "tab" of window id 1 to finalTime
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to false
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to true
else if con_status is "10" then
set content of control "pegel_con" of tab view item "Connection" of tab view "tab" of window id 1 to 1
set enabled of button "Connect" of tab view item "Connection" of tab view "tab" of window id 1 to true
set enabled of button "Disconnect" of tab view item "Connection" of tab view "tab" of window id 1 to false
end if
display dialog "here1"
-- Anzeige empfangene Daten
tell application "Internet Connect"
set bytes_received to bytes received of status as string
end tell
set received_print to bytes_received / 1024
set received_mb to received_print / 1024
set received_final to received_mb as integer
set contents of text field "print_received" of tab view item "Setting" of tab view "tab" of window id 1 to received_final
display dialog "here2"
-- Anzeige gesendetete Daten
tell application "Internet Connect"
set bytes_sent to bytes sent of status as string
end tell
set sent_print to bytes_sent / 1024
set sent_mb to sent_print / 1024
set sent_final to sent_mb as integer
set contents of text field "print_sent" of tab view item "Setting" of tab view "tab" of window id 1 to sent_final
display dialog "here3"
return 1
serialport close
end if
end idle