Scripts, tutorials, and general Desktop X help
Published on February 17, 2007 By sViz In DesktopX
I'm trying to get a message box that does not allow the user to interact with the object, or does not allow the script to continue running until the message box is OK'd. The object checks internet connectivity every minute and if there's no connection it prompts the message box. The problem is the script keeps running and every minute it puts up another message box. I have tried Application Modal, and System Modal and none seem to work.

I used this line:

message = msgbox ("No internet connection", 4096)
on Feb 23, 2007
Anyone know anything about this?
on Feb 23, 2007
You've probably seen this . . but just in case it might help:


Dim IsConnected

'Called when the script is executed
Sub Object_OnScriptEnter
       Set Sh = CreateObject("WScript.Shell")
       On Error Resume Next
       units =
       If err.number <> 0 Then
               units = "m"
       End If
       location =
       If err.number <> 0 Then
               location = "48188"
       End If

       IsConnected = System.InternetConnected
       If IsConnected Then
               DesktopX.ScriptObject("wow_netstatus").Object.State = "On"
               DesktopX.ScriptObject("wow_netstatus").Object.ToolTipText =
"Currently working online"
               DesktopX.ScriptObject("wow_netstatus").Object.State = "Off"
               DesktopX.ScriptObject("wow_netstatus").Object.ToolTipText =
"Currently working offline"
               DesktopX.Object("wow_lastupdate").Text = "Last Update: None
- Offline"
               Msgbox "You are currently offline. The Natural Desktop can
only provide accurate weather information if you are online." & vbNewLine &
vbNewLine & "Once you have connected to the Internet click the connection
icon in the corner of the weather window.", vbExclamation + vbOKOnly,
"Connection error ..."
       End If

       Object.SetTimer 6001, 600000
End Sub

(From Kris)

on Feb 24, 2007
Thanks zubaz. From reading the documentation I got an idea. I decided to have two different timers; one for checking internet connection and assigning the result to a variable, and the other for pulling info from the net & showing the message box. If the 2nd timer finds the variable is false it shows the message box & kills itself so it doesn't keep pulling info and putting up new message boxes. This method allows the other timer to continue running and checking for internet connection without pulling any data and showing any message boxes.

The problem before was that I checked the connection, pulled the data, and showed a message box all on the same timer. So, I couldn't kill the timer to stop pulling data and showing msgboxes, because then I wouldn't be able to check the connection at intervals.
on Feb 25, 2007

Added result = Desktopx.MsgBox(msg, flags, title, ownerName). This msgbox function let you
get control of z-order, by passing the name of the owner object. Also, the msgbox thread will
reply synchronously.
on Feb 25, 2007
By the way, I think the docs are wrong. You cant access Desktopx.MsgBox.
But if you try Script.MsgBox then that should work.

The docs doesn't say anything about the Script namespace.
on Feb 25, 2007
sVis, Did I help or not?    
on Feb 27, 2007
Well you pointed me in the right direction. Got my noodle cranking again. I almost decided to do without the message box altogether. So, yeah, you helped.

Hey, thomassen I'll have to try that out and get back to you.

On a side note: I just noticed the reply rating and reporting buttons! Will good ratings bring up a person's score or something?
on Feb 27, 2007
On a side note: I just noticed the reply rating and reporting buttons! Will good ratings bring up a person's score or something?

They give you "points."  What can you do with points?  Nothing, I think.  If we could trade them in for Frogbucks that we could use at the company store or toys like at the carnival I'd care more . . but today . . meh.