TheDcoder Posted May 27, 2015 Share Posted May 27, 2015 Hello , I use AutoIt Form Studio to design my GUIs... It has a bad habit of add up all the magic numbers when generation the code. Now I want to know which styles I am using for my button. Thanks in Advance, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2015 Moderators Share Posted May 27, 2015 (edited) TheDcoder,The styles are all found in the relevant *Constants.au3 file, so look at the values there and determine which ones add up to the numeric value you have - if Windows can do it then so can you. Start with the most common ones - you should remember the more esoteric ones you asked for in the GUI designer.I would also suggest asking the author of the designer to change its behaviour to use the style names rather than magic numbers - and certainly not to sum them.M23Edit: If you decide to code something, BitAND would be a good place to start looking in the Help file. Edited May 27, 2015 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted May 27, 2015 Share Posted May 27, 2015 You can also do it using BitAND and testing against every possible button style constant. Something like what I did in the updated GUIToolTip function _GUIToolTip_BitsToTTF. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheDcoder Posted May 27, 2015 Author Share Posted May 27, 2015 @Melba23 Bit Operations? They are a nightmare for me @BrewManNH Yay! That looks easy EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2015 Moderators Share Posted May 27, 2015 TheDcoder.I suggest BitAND and you say: "a nightmare".BrewManNH suggests BitAND and you say: "that looks easy".So which is it?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheDcoder Posted May 27, 2015 Author Share Posted May 27, 2015 I suggest BitAND and you say: "a nightmare".Bit Operations? They are a nightmare for me I don't understand Bit Operations, but I got an Idea (about checking if a magic number is added in the added up magic number) after looking at BrewManHN's function. I have a question.Q. How can I calculate magic numbers? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2015 Moderators Share Posted May 27, 2015 TheDcoder,That makes no sense - magic numbers are just the numeric values of constants set by Windows, you cannot "calculate" them. If you mean determine if a particular value is included then you just need to use BitAND as was suggest earlier. Look at the Setting Styles tutorial in the Wiki to understand how it works - the "Multiple Styles" section is what you need.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheDcoder Posted May 27, 2015 Author Share Posted May 27, 2015 magic numbers are just the numeric values of constants set by Windows, you cannot "calculate" them Looks like I misunderstood the whole concept of magic numbers... I thought 16, 32, 64 etc. were magic numbersP.S I found the formula . It is 2 ^ n EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Developers Jos Posted May 27, 2015 Developers Share Posted May 27, 2015 Looks like I misunderstood the whole concept of magic numbers... I thought 16, 32, 64 etc. were magic numbersP.S I found the formula . It is 2 ^ nYou seriously need to start investing in learning and understanding things you are doing and you'll find programming becomes easier. So stop saying stuff like " I don't understand" and start finding out what it means and understanding it.Jos TheDcoder 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2015 Moderators Share Posted May 27, 2015 TheDcoder,Correct - and so now you know how to determine which magic numbers are hidden inside the combined total given by your GUI designer.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
TheDcoder Posted May 27, 2015 Author Share Posted May 27, 2015 @Jos Thanks for the inspiration I found out that "What I thought Magic Numbers were" is "Base 2 Mathematics" . I made this little function:Func BreakMagicNumbers($iNumber, $iMaxParams = 49) Local $sReturn = "" For $i = 0 To $iMaxParams $iMagicNumber = CalculateMagicNumber($i) If BitAND($iNumber, $iMagicNumber) <> 0 Then $sReturn &= $iMagicNumber & '|' Next Return StringTrimRight($sReturn, 1) EndFunc Func CalculateMagicNumber($iNumber) Return 2 ^ $iNumber EndFuncIts not tested yet... Hope it may help somebody, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2015 Moderators Share Posted May 27, 2015 TheDcoder,Its not tested yet...I know, because it will not work correctly as it is written. Go and look at the various constants - they are not all powers of 2, although that is a major element of their differentiation. Look at these button styles:Global Const $BS_SPLITBUTTON = 0x0000000C Global Const $BS_DEFSPLITBUTTON = 0x0000000D Global Const $BS_COMMANDLINK = 0x0000000E Global Const $BS_DEFCOMMANDLINK = 0x0000000FLike Jos said, you need to start by understanding exactly how Windows constants work (which is explained in that tutorial to which I linked) - then you can code something which will extract the data you require. Hint: you will need to use the *Constants.au3 files in there somewhere.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iamtheky Posted May 27, 2015 Share Posted May 27, 2015 examples should be.....more example-ish: Like, fix all the magic numbers in this line, while leaving those that lack magical ability.msgbox(0, 0, 0, 0, 0) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
TheDcoder Posted May 28, 2015 Author Share Posted May 28, 2015 @boththose @Melba23 I have dropped the Idea of making a function, I am getting distracted from my main project EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheDcoder Posted June 7, 2015 Author Share Posted June 7, 2015 @Melba23 I have picked up my to make a magic number calculator EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 7, 2015 Moderators Share Posted June 7, 2015 TheDcoder,I will be interested to see the result.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
czardas Posted June 7, 2015 Share Posted June 7, 2015 I have picked up my to make a magic number calculator Well if you feel inclined to generate random magic numbers with your calculator, you might want to take a look at ORSplit and XORSplit operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
TheDcoder Posted June 7, 2015 Author Share Posted June 7, 2015 Thanks @czardas EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
czardas Posted June 7, 2015 Share Posted June 7, 2015 (edited) I'm not sure why you might need random magic numbers, but it was an interesting exercise for me at the time. I haven't seen this function written by anyone else previously but I'm sure there are plenty of potential applications. I also imagine it will have been done before. Sometimes making things like this helps you to understand the way other things work. These small exercises helped me a lot.Actually these functions were related to an encryption idea, but I didn't use them in the end. Edited June 7, 2015 by czardas operator64 ArrayWorkshop 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