czardas Posted August 20, 2011 Share Posted August 20, 2011 is there a way to like make the menu items an array? So it's like: Case $Msg = $Item_Block[0 (or) 1 (or) 2] If $Msg = $Item_Block[0] Then $Blocking[0] = 3 If $Msg = $Item_Block[1] Then $Blocking[0] = 2 If $Msg = $Item_Block[2] Then $Blocking[0] = 1 Settings() Sure, why not? You could use something like this: Global $Item_Block[3], $menuID $menuID = GUICtrlCreateMenu("Name") $Blocking[0] = GUICtrlCreateMenuItem ( "Item 1", $menuID) $Blocking[1] = GUICtrlCreateMenuItem ( "Item 2", $menuID) $Blocking[2] = GUICtrlCreateMenuItem ( "Item 3", $menuID) ...combined with something like this. Switch $Msg Case $Item_Block[0] $Blocking[0] = 3 Case $Item_Block[1] $Blocking[0] = 2 Case $Item_Block[2] $Blocking[0] = 1 EndSwitch Settings() operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
MvGulik Posted August 20, 2011 Share Posted August 20, 2011 ... Might work(read) better with something like ...(dim) Enum $_Taskmgr,_ $_Shutdown_, $_All_ "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Blue_Drache Posted August 20, 2011 Share Posted August 20, 2011 Wouldn't using a hex format on the stored variable make more sense? 0x00000000 to 0x11111111 ?? That way you could BitAND() them? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
MvGulik Posted August 20, 2011 Share Posted August 20, 2011 Wouldn't using a hex format on the stored variable make more sense? 0x00000000 to 0x11111111 ?? That way you could BitAND() them?- Bit*(): All ready covered/suggested by czardas.- Hex: Hex format is not a internal data format. Its just a different visual way of showing a number.- 0101: Your sure you mean Hex with "0x00000000 to 0x11111111". Looks like your actually referring to binary-Bit display of a number, which is not the same as Hex-number display (0..F). "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
rcmaehl Posted August 20, 2011 Author Share Posted August 20, 2011 Okay, I'm like completely stuck. I've included the entire script with this post and if you can and will, then please see if you can get the Settings() function to work. It's currently commented out. The lines that apply to the settings() function are lines: 29, 225 - 238, 272, 405 - 433, 461 and 466.URSafe.au3 My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
guinness Posted August 20, 2011 Share Posted August 20, 2011 (edited) Just out of curiosity why not pass the variable to the function e.g. _Settings($iVariable) I would do away with most of the Global variables and use Local scope if I could, just because it can cause problems in the long run with debugging etc. Here is a working example of what I think you're trying to achieve... #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> _Main() Func _Main() Local $aControlID[2], $iMenu GUICreate("Example by guinness 2011", 300, 200) $iMenu = GUICtrlCreateMenu("&Example") $aControlID[0] = GUICtrlCreateMenuItem("Item 1", $iMenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $aControlID[1] = GUICtrlCreateMenuItem("Item 2", $iMenu) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $aControlID[0] _Settings(1) Case $aControlID[1] _Settings(2) EndSwitch WEnd EndFunc ;==>_Main Func _Settings($iItem) Return ConsoleWrite("The item passed was ==> " & $iItem & @LF) EndFunc ;==>_Settings Edited August 20, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
rcmaehl Posted August 20, 2011 Author Share Posted August 20, 2011 Just out of curiosity why not pass the variable to the function e.g. _Settings($iVariable) I would do away with most of the Global variables and use Local scope if I could, just because it can cause problems in the long run with debugging etc. Here is a working example of what I think you're trying to achieve... #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> _Main() Func _Main() Local $aControlID[2], $iMenu GUICreate("Example by guinness 2011", 300, 200) $iMenu = GUICtrlCreateMenu("&Example") $aControlID[0] = GUICtrlCreateMenuItem("Item 1", $iMenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $aControlID[1] = GUICtrlCreateMenuItem("Item 2", $iMenu) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $aControlID[0] _Settings(1) Case $aControlID[1] _Settings(2) EndSwitch WEnd EndFunc ;==>_Main Func _Settings($iItem) Return ConsoleWrite("The item passed was ==> " & $iItem & @LF) EndFunc ;==>_Settings I think I understand. Let me try it. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
guinness Posted August 20, 2011 Share Posted August 20, 2011 When you reply try not to click on 'Add Reply' because quotes the post from before unnecessarily.Let me try it.I didn't want to add it myself, because it's best if you learn via trial & error. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
rcmaehl Posted August 20, 2011 Author Share Posted August 20, 2011 \O/ Success, and it isn't as laggy in wine which is good. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
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