have XOJO hit enter for you

I have a timer going, and every 1 second it opens a message box, but the box is waiting for me to hit enter. how can I do that, or how can I have the message box go away on its own after 1 second

I think you have to do your own dialog box with a window.

Use a window instead with the same design as the MsgBox, so either the user closes it with the button, or you close it in code.

I come from Applescript, I am NOT a coder per se. Here is how you do what I need in Applescript.

display dialog “hi” giving up after 1 second

so easy with Apple,
not that easy in XOJO

[quote=221426:@Shawn Brady]I come from Applescript, I am NOT a coder per se. Here is how you do what I need in Applescript.

display dialog “hi” giving up after 1 second

so easy with Apple,
not that easy in XOJO[/quote]

AppleScript is an automation scripting system. Xojo is a full fledged development environment.

You are accustomed to AppleScript. You discover a new, much more powerful environment. Think about learning a Foreign language. It needs a learning curve.

Avail yourself of the Introduction to programming book at https://xojo.com/learn/ and make the effort to read it. Same thing for the books in the Documentation folder next to the Xojo IDE executable.

  • Drag a window in your project from the library. Make it the proper size.
  • Place a label over it and change the Text property to Hi
  • To show the dialog, use (admitting it is named Window2) :
Window2.show
  • To close it, use :
Window2.close

You can place that code in a timer Action event to retire it after one second, or in a button you place on the window.

Now, just to show you the remarkable Xojo flexibility,

  • create a script in AppleScript :
display dialog "Hi"
  • Save as Hi.scpt
  • Drag Hi.scpt in the project (left pane)
  • In your code, enter :
Hi

See the AppleScript messageBox displayed.

You can add all sorts of AppleScripts to Xojo that way. You can even get a value back from the JavaScript with something like

myValue = theScript

Easy, right ?

Michel thanks a million, I do need to read books. Applescript had one by Hanaan Rosenthal. I learned so much. I am aware Xojo is way more powerful and I need to learn every inch of it. thanks. I am motivated.

Can you use buttonName.Push for a desktop app?

Sure. But not on a MsgBox button…

with AppleScript
(giving up after 2 = close after 2 seconds)

  dim mymessage as string = "Hello" //// your Message here
  dim mytitle as string = "Message" //// your Title here
  
  dim sh as new Shell
  sh.Execute "/usr/bin/osascript <<-EOF" + EndOfLine _
   + "display dialog """ + mymessage + """ with title """ + mytitle _
  + """ buttons ""OK"" default button 1 giving up after 2" _
  + EndOfLine + "EOF"

And if you want to have an icon in the MessageBox, drag a picture (png or icns) to Xojo Navigator
(for example the picture is ‘icon.icns’)