Jump to content

MsgBox 4 return value ?


Recommended Posts

Hello guy got some trouble in this easy script

 

Case $BoutonWhrite1
                 $Case1 =  MsgBox (4,"Are you sure ?" ,"Reg key gonna be changed." )
                  While 1
                    If $Case1 = "No" Then
                       ConsoleWrite(">Case -1 Started" & @CRLF)
                       ExitLoop
                    EndIf
                        $InputType = InputBox ("Value Type ?", 'Type of key to write: "REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY".' )
;~                      RegWrite (""&Reg1,""&$RegName1,""&$InputType, ""&$RegValue1)
                        ExitLoop
                  WEnd

I tryed

If $case1 = 1

If $case1 = -1

If $case1 = "No"

 

What is the returned value by the msg box YES or NO ?

 

The script is going wrong about the final purpose (Whrite a Registry key if the Script user unswer YES ) But dont take attention i am gonna corect after get the returned value xD it was for testing. 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

nvm

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I watched the help file and missed the return value section... :>

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

56 minutes ago, caramen said:

I tryed

If $case1 = 1

If $case1 = -1

If $case1 = "No"

 

What is the returned value by the msg box YES or NO ?

 

Don't use maic numbers use the constansts, its easier to read source:

#include <MsgBoxConstants.au3>

While 1
    $iAnwer = MsgBox($MB_ICONQUESTION + $MB_YESNO, "Title", "Are you sure ?", "Reg key gonna be changed.")
    Switch $iAnwer
        Case $IDYes
            MsgBox(0, 'You clicked:', 'Yes')
            Exit
        Case $IDNo
            MsgBox(0, 'You clicked:', 'No')
    EndSwitch
WEnd

 

Link to comment
Share on other sites

It s working anyway so, this is just a preference thing :) Thx for the tips anyway. 

 

Case $BoutonWhrite1
                 $Case1 =  MsgBox (4,"Are you sure ?" ,"Reg key gonna be changed." )
                    If $Case1 = 7 Then
                       ConsoleWrite(">Case -1 Started" & @CRLF)
                    ElseIf $Case1 = 6 Then
                        $InputType1 = InputBox ("Value Type ?", 'Ecrivez le type de clef:'& @CRLF&'"REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY".' )
                        If $InputType1 = 'REG_SZ' Or 'REG_MULTI_SZ' Or 'REG_EXPAND_SZ' Or 'REG_DWORD' Or 'REG_QWORD' Or 'REG_BINARY' Then
                           MsgBox($MB_SYSTEMMODAL, "", $InputType1&" was entered")
                           ConsoleWrite(">Registre ecri" & @CRLF)
;~                      RegWrite (""&$Reg1,""&$RegName1,""&$InputType1, ""&$RegValue1)
                        Else
                           ConsoleWrite(">Registre non ecri" & @CRLF)
                        MsgBox($MB_SYSTEMMODAL, "Attention", "Le type n'est pa correct")
                        EndIf
                    EndIf

New probleme i use Input box to get the Reg key added but i want to add a security check

If the type is not like in the condition then Msgbox 

 

Why the returned value of the inputbox is activating the first condition always ??? even if i type ALLo or test or lol i want to passe it only in these case : 

'REG_SZ' Or 'REG_MULTI_SZ' Or 'REG_EXPAND_SZ' Or 'REG_DWORD' Or 'REG_QWORD' Or 'REG_BINARY'

 

but seem like it s totaly ignoring them 

 

Rofl i dont get it... So easy syntax but not working LOL ...........:'(

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

ops i got it : 

If $InputType1 = 'REG_SZ' Or $InputType1 = 'REG_MULTI_SZ' Or $InputType1 ='REG_EXPAND_SZ' Or $InputType1 ='REG_DWORD' Or $InputType1 ='REG_QWORD' Or $InputType1 ='REG_BINARY' Then

@Synapsee

True... I am gonna do that

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

my bad:
 

$Case1 = MsgBox(4, "Are you sure ?", "Reg key gonna be changed.")
If $Case1 = 7 Then
    ConsoleWrite(">Case -1 Started" & @CRLF)
Else
    $InputType1 = InputBox("Value Type ?", 'Ecrivez le type de clef:' & @CRLF & '"REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY".')
    If StringInStr('REG_SZ|REG_MULTI_SZ|REG_EXPAND_SZ|REG_DWORD|REG_QWORD|REG_BINARY', $InputType1, 1) Then
        MsgBox(64, "", $InputType1 & " was entered")
        ConsoleWrite(">Registre ecri" & @CRLF)
;~                      RegWrite (""&$Reg1,""&$RegName1,""&$InputType1, ""&$RegValue1)
    Else
        ConsoleWrite(">Registre non ecri" & @CRLF)
        MsgBox(48, "Attention", "Le type n'est pa correct")
    EndIf
EndIf

 

Regards,
 

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

×
×
  • Create New...