thewind27 Posted November 9, 2011 Share Posted November 9, 2011 I have been worked on an Excel sheet which use ONLY cell A and B. When I input the Hex MEID to cell A1, Cell B1 will show the result in Dec. I use this formula in cell B for the conversion: =HEX2DEC(LEFT(A1,8))&"0"&HEX2DEC(RIGHT(A1,6)) So my target is using the same method but put this on AutoIt I created a GUI which has 2 large text box. The one on the left is to input the Hex values, the one on the right is output the Dec values. And 1 Convert button to execute this function Please help me out, how can I translate the formula to AutoIt function. Thanks Link to comment Share on other sites More sharing options...
enaiman Posted November 9, 2011 Share Posted November 9, 2011 (edited) This should be the equivalent: Dec(StringLeft("your cell content here", 8))&"0"&Dec(StringRight("your cell content here", 6))Just replace the text between quotes with the cell content and test it. Edit: changed code tags to AutoIt tags. Edited November 10, 2011 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
thewind27 Posted November 10, 2011 Author Share Posted November 10, 2011 I didn't mean using AutoIt to work with Excel I want 2 text boxes, the one on the left in INPUT and the one on the right is OUTPUT For example: I put 5 lines of ENSs or MEIDs on the left. The right Text box will give me 5 lines of DEC ENSs in a perspectively I dont want to use Excel any more Link to comment Share on other sites More sharing options...
Carlo84 Posted November 10, 2011 Share Posted November 10, 2011 the example posted by enaiman does just that.. just put it in a func. and handle your lines. _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
enaiman Posted November 10, 2011 Share Posted November 10, 2011 I gave you a solution to what you wanted. From now on, it is in your hands. Do a little bit of reading about GUICtrlRead, StringSplit, GUICtrlSetData ... what you want to do is easy, make the effort to do it yourself. It will help. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
thewind27 Posted November 12, 2011 Author Share Posted November 12, 2011 Thank you, guys! I understand the concept of the function now. But i ran to another trouble. I dont know if my code is right but it doesn't work Here it is: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("MEID Converter", 243, 129, 192, 124) $input = GUICtrlCreateInput("", 8, 8, 225, 21) $output = GUICtrlCreateInput("", 8, 96, 225, 21) $convert = GUICtrlCreateButton("Convert", 72, 40, 97, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $convert $output= Dec(StringLeft($input, 8))&"0"&Dec(StringRight($input, 6)) EndSwitch WEnd Would you please check it for me? Thanks Link to comment Share on other sites More sharing options...
czardas Posted November 12, 2011 Share Posted November 12, 2011 (edited) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("MEID Converter", 243, 129, 192, 124) $input = GUICtrlCreateInput("", 8, 8, 225, 21) $output = GUICtrlCreateInput("", 8, 96, 225, 21) $convert = GUICtrlCreateButton("Convert", 72, 40, 97, 41) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $convert GUICtrlSetData($output, Dec(StringLeft($input, 8))&"0"&Dec(StringRight($input, 6))) EndSwitch WEnd Is this any good? Edited November 12, 2011 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
thewind27 Posted November 12, 2011 Author Share Posted November 12, 2011 Thanks but it still doesn't work Regardless the value of the input, the ouput always be "303" I dont know why Link to comment Share on other sites More sharing options...
czardas Posted November 12, 2011 Share Posted November 12, 2011 (edited) Well I don't understand what your code is meant to do exactly. Nor do I understand what you intend to type in the Input control. Perhaps you could provide some examples of the input and expected output. It looks like you want to convert a bunch of characters from the right and left hand side of a hex value to decimal, and then bang a zero between them. I'm not familiar with so many Excel formulas. What is the Hex MEID? Edited November 12, 2011 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