Jump to content

Simple Msgbox Question


Jakobi
 Share

Recommended Posts

Hello,

I am new to this and had a question. I have a msg box that is set to yes/no. How do I define upon selection the next action, if that makes sense.

IE.

If they press yes I need it to open a file, and if they press no it closes the script?

Thanks for any direction.

Also, is there a way to change the autoit icon so that the scripts can appear different to my users.

Link to comment
Share on other sites

Hi,

If MsgBox(4, "Example", "Press a button :-)") = 6 Then
    MsgBox(0, "OK", "You pressed Yes!", 3)
Else
    MsgBox(0, "Cancel", "You pressed No!", 3)
EndIf

And compile with options offers the possibility to change the icon.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hello,

I am new to this and had a question. I have a msg box that is set to yes/no. How do I define upon selection the next action, if that makes sense.

IE.

If they press yes I need it to open a file, and if they press no it closes the script?

Thanks for any direction.

Also, is there a way to change the autoit icon so that the scripts can appear different to my users.

If you use SCITE as your editor it has awsome tools in it to help you code. The tool you want is called CodeWizard and will make any kind of message box you want + a whole lot more.

SCITE FILES: http://www.autoitscript.com/autoit3/scite/downloads.php

Edited by wkeeter
Link to comment
Share on other sites

I guess I only had AutoIt installed before...so now I have it. Thanks. Also figured out how to change the icon. Thanks again.

Is this close:

If MsgBox(4100, "Pipeline Reports", "Would you like to try to logon now?", 60) = 6 Then
    FileGetShortcut("shortcut.lnk")
Else
    MsgBox(0, "Cancel", "Any questions then contact me.", 3)
EndIf

Is this close...trying to get it so when yes is clicked it opens my shortcut

Link to comment
Share on other sites

I guess I only had AutoIt installed before...so now I have it. Thanks. Also figured out how to change the icon. Thanks again.

Is this close:

If MsgBox(4100, "Pipeline Reports", "Would you like to try to logon now?", 60) = 6 Then
    FileGetShortcut("shortcut.lnk")
Else
    MsgBox(0, "Cancel", "Any questions then contact me.", 3)
EndIf

Is this close...trying to get it so when yes is clicked it opens my shortcut

That will not open your shortcut but will give you info about the shortcut.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Moderators

Untested, but I imagine ShellExecute will work:

If MsgBox(4100, "Pipeline Reports", "Would you like to try to logon now?", 60) = 6 Then
    $aSCut = FileGetShortcut("shortcut.lnk")
    If IsArray($aSCut) Then 
        ShellExecute($aSCut[0])
    Else
         MsgBox(16, 'Error', 'There was an error getting the Path')
    EndIf
Else
    MsgBox(0, "Cancel", "Any questions then contact me.", 3)
EndIf

Edit:

Guess it would help if I knew that FileGetShortCut() returned an array

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...