I hope you can help me again with a syntax problem:
setting a button do false can be done with:
set enabled of button "Connect" of window "main" to false
set enabled of button "Disconnect" of window "main" to true
the if clause will sound like this:
if then
else if
end if
the Connection state of the Internet will go like this
tell aplication "Internet Connect"
set conn_status to state of status as string
--set conn_status to 1
set conn_list to {"Not Connected", "Dialing", "Connecting...", "Error", "Connected", "Disconnecting...", "n/a", "Connected", "Connected", "Disconnecting...", "Could not connect"}
set conn_status to item (conn_status) of conn_list
end tell
The State will return a 0, 1, 2, 3,4,7,8,9,10
How can I set the state of the button to false if the returned state of the connection is p.ex. 8?
Thanks for your help and best regards,
Stefan
Model: iBook G4 with 1.2GHZ
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
tell application "Internet Connect"
set conn_status to state of status
--set conn_status to 1
set conn_list to {"Not Connected", "Dialing", "Connecting...", "Error", "Connected", "Disconnecting...", "n/a", "Connected", "Connected", "Disconnecting...", "Could not connect"}
if conn_status is 8 then
set enabled of button "Connect" of window "main" to false
end if
set conn_status to item (conn_status) of conn_list
end tell
or in this case you can put the if - then statement into one line without the end if statement
if conn_status is 8 then set enabled of button "Connect" of window "main" to false
thanks again for your help, but as I have tried this I got the following error message:
A " can’t go after this identifier.
the mark (for the error) goes around " button “Connect” "
tell application "Internet Connect"
set conn_buttons to state of status
if conn_buttons is 8 then
set enabled of button "Connect" of window "main" to false
set enabled of button "Disconnect" of window "main" to true
else if conn_buttons is 0 then
set enabled of button "Disconnect" of window "main" to false
set enabled of button "Connect" of window "main" to true
end if
tell application "Internet Connect"
set connectionState to state of status
end tell
set connectedFlag to connectionState is 8
set enabled of button "Connect" of window "main" to not connectedFlag
set enabled of button "Disconnect" of window "main" to connectedFlag
tell application "Internet Connect"
set connectionState to state of status
end tell
set connectedFlag to connectionState is not 8
set enabled of button "Connect" of window "main" to connectedFlag
set enabled of button "Disconnect" of window "main" to not connectedFlag
The next goals are:
Password protection of the file
Refresh of the connection state
Selection of the modem