Jump to content

Recommended Posts

Posted (edited)

Hello.

I just need some quick help on MsgBoxes.

Heres what I need to do.

If you press New, then it will check $DocEd1 for text, if there is none, it will clear the box. But if there is text in $DocEd1 then I need a MsgBox with Yes and No.

MsgBox(0x1004, "Save Document?", "There is text in the document, would you like to save it?")
oÝ÷ ØØzȬ¦·¬±çb·¥Æ¯z+pØZºÚ"µÍÌÍÔØ]QH[TØ]QX[ÙÊ    ][ÝÔØ]I][ÝË^QØÝ[Y[Ñ ][ÝÕ^ØÝ[Y[


_ÙXÝHØÝ[Y[

XÝ
_]]Ú]ØØÝ[Y[

]LÊI][ÝËMBTÝÚ]ÚÕRPÝXY
    ÌÍÑØÌJBBPØÙHBIÌÍÝ^HÕRPÝXY
    ÌÍÑØÑYJBQ[ÝÚ]ÚIÌÍÙ[Z[HH[SÜ[ ÌÍÔØ]QBQ[UÜ]J  ÌÍÙ[Z[K  ÌÍÝ^
BQ[PÛÜÙJ ÌÍÙ[Z[JB

But if there isn't it will clear the box.

Secure

Edit: Just changed the MsgBox to yes and no with 0x1004, but the same question please.

Edited by Secure_ICT
Posted

Hi,

sorry I do not get it. :"> Can you post an working example?

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

Posted (edited)

Thats the point Mega, I would post an example if I could get it working :P

OK, Ill try explain again.

User presses New.

The program reads $DocEd1 for text, if there is none, then it will do:

$Empty = ""
GuiCtrlSetData($DocEd1, $Empty)
[/autoit[

But if there is text then it will display the Yes/No box which asks if they want to save.

If the user presses Yes, then the Save box will appear 
[autout]
$SaveDir = FileSaveDialog("Save", @MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)", 16)
    Switch GUICtrlRead($Doc1)
        Case 0
        $text = GUICtrlRead($DocEd1)
    EndSwitch
    $filehandle = FileOpen($SaveDir, 2)
    FileWrite($filehandle, $text)
    FileClose($filehandle)
 oÝ÷ Ø   Ýûazë®Þ²Ç¬­Âív§ÊØbrêÞm*&zØb    bïÛjëh×6
                        If $DocEd1 == $Empty Then 
                            GuiCtrlSetData($Empty)
                        Else
                            $NewDoc =  MsgBox(0x1004, "Save Document?", "There is text in the document, would you like to save it?")
                            If $NewDoc = True Then
                                $SaveDir = FileSaveDialog("Save", @MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)", 16)
                                Switch GUICtrlRead($Doc1)
                                    Case 0
                                        $text = GUICtrlRead($DocEd1)
                                    EndSwitch
                                    $filehandle = FileOpen($SaveDir, 2)
                                    FileWrite($filehandle, $text)
                                    FileClose($filehandle) 
                                Else If $NewDoc = True Then
                                    GuiCtrlSetData($Empty)
                                    EndIf
Edited by Secure_ICT
  • Moderators
Posted

If MsgBox(0x1004, "Save Document?", "There is text in the document, would you like to save it?") = 6 Then 
    MsgBox(64, 'Info', 'You pressed Yes')
Else
    MsgBox(64, 'Info', 'You pressed No')
EndIf

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.

Posted

Hi,

#include <GUIConstants.au3>

GUICreate(" My GUI input acceptfile", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES
$input = GUICtrlCreateInput("", 10, 5, 300, 20)
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

GUISetState()


While 1
    Switch GUIGetMsg()
        Case $btn
            If GUICtrlRead($input) = "" Then
                $a = MsgBox(0x1004, "", "What?")
                If $a = 6 Then
                    MsgBox(0, "", "yes!")
                Else
                    MsgBox(0, "", "No!")
                EndIf

                ;ExitLoop
            EndIf
    EndSwitch
WEnd

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

Posted

Case $New
                        $Enpty = ""
                        If $DocEd1 = $Empty Then 
                            GuiCtrlSetData($Empty)
                        Else
                            If MsgBox(0x1004, "Save Document?", "There is text in the document, would you like to save it?") = 6 Then 
                                $SaveDir = FileSaveDialog("Save", @MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)", 16)
                                Switch GUICtrlRead($Doc1)
                                    Case 1
                                        $text = GUICtrlRead($DocEd1)
                                    EndSwitch
                                    $filehandle = FileOpen($SaveDir, 2)
                                    FileWrite($filehandle, $text)
                                    FileClose($filehandle)
                                Else
                                    GuiCtrlSetData($Empty)
                        EndIf

Does not work.

  • Moderators
Posted

And what doesn't work? Are supposed to guess what you've messed up on?

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.

Posted

I've done it now.

Thanks everyone

Case $New
            If GuiCtrlRead($DocEd1) = "" Then
                GuiCtrlSetdata($DocEd1, "")
                Else
            $newsave = MsgBox(0x1004, "Save Document?", "There is text in the document, would you like to save it?")
            If $newsave = 6 Then
                $SaveDir1 = FileSaveDialog("Save", @MyDocumentsDir, "Text Document(*.txt)|Secure Document(*.ict)|Autoit Doccument(*.au3)", 16)
                    Switch GUICtrlRead($Doc1)
                        Case 0
                            $text = GUICtrlRead($DocEd1)
                        EndSwitch
                    $filehandle = FileOpen($SaveDir1, 2)
                    FileWrite($filehandle, $text)
                    FileClose($filehandle)
                    Else
                        GuiCtrlSetData($DocEd1, "")
                    EndIf
                    EndIf

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
×
×
  • Create New...