caramen Posted June 7, 2016 Posted June 7, 2016 (edited) 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 June 7, 2016 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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Terenz Posted June 7, 2016 Posted June 7, 2016 On the help of MsgBox there are all the return value: Yes = 6 = $IDYES No = 7 = $IDNO MsgBox You can see also adding: MsgBox(0,0,$Case1) After that MsgBox Synapsee 1 Nothing is so strong as gentleness. Nothing is so gentle as real strength
caramen Posted June 7, 2016 Author Posted June 7, 2016 (edited) nvm Edited June 7, 2016 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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Trong Posted June 7, 2016 Posted June 7, 2016 See help file or https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm #include <MsgBoxConstants.au3> Local $Case1 = MsgBox($MB_YESNO + $MB_ICONQUESTION, "title", "text") If $Case1 = $IDYES Then MsgBox($MB_ICONINFORMATION, "", "Yes is Pressed") Else MsgBox($MB_ICONINFORMATION, "", "No is Pressed") EndIf Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
caramen Posted June 7, 2016 Author Posted June 7, 2016 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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
AutoBert Posted June 7, 2016 Posted June 7, 2016 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
caramen Posted June 7, 2016 Author Posted June 7, 2016 (edited) 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 June 7, 2016 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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Synapsee Posted June 7, 2016 Posted June 7, 2016 plz caramen, post a code who can be run not just a single part. anyway for choose between sz, multi, dword, qword, ... a combobox seems more better. try the sample here : https://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateCombo.htm
caramen Posted June 7, 2016 Author Posted June 7, 2016 (edited) 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 June 7, 2016 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 - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
Trong Posted June 7, 2016 Posted June 7, 2016 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 Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now