dmca Posted August 13, 2008 Share Posted August 13, 2008 Hi, I just started using this fantastic app today. I'm planning on using it in my carPC to automate a few tedious processes that would otherwise cause me to crash my car. I'm working on a script that requires me to convert an octal into its hexadecimal equivalent and I was hoping there would be a built-in function available that would do the hard work for me. I have my script completed barring this one, small problem. There doesn't seem to be a oct() function mentioned anywhere. I know I could spend a half an hour an code a function that will do this for me but I'm wondering ( hoping ) that some AutoIT guru has done this already and would be willing to share the knowledge. Thanks!! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 13, 2008 Moderators Share Posted August 13, 2008 http://www.autoitscript.com/forum/index.ph...092;octal\ Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
therks Posted August 14, 2008 Share Posted August 14, 2008 http://www.autoitscript.com/forum/index.ph...mp;p=94300& My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Malkey Posted August 14, 2008 Share Posted August 14, 2008 (edited) dmca said: Hi, I just started using this fantastic app today. I'm planning on using it in my carPC to automate a few tedious processes that would otherwise cause me to crash my car. I'm working on a script that requires me to convert an octal into its hexadecimal equivalent and I was hoping there would be a built-in function available that would do the hard work for me. I have my script completed barring this one, small problem. There doesn't seem to be a oct() function mentioned anywhere. I know I could spend a half an hour an code a function that will do this for me but I'm wondering ( hoping ) that some AutoIT guru has done this already and would be willing to share the knowledge. Thanks!! And yet another choice for your consideration. $iDec = 17 $iOct = StringFormat("%o", $iDec) ; <== Conversion Dec 2 Oct $iOct2Hex = Hex(Oct2Dec($iOct), 6) ; <== Conversion Oct 2 Hex MsgBox(0, "Octal2Decimal", _ "Decimal = " & $iDec & @CRLF & _ "Hexidecimal = 0x" & Hex($iDec, 6) & @CRLF & _ "Octal = " & $iOct & @CRLF & _ "Oct2Hex = 0x" & $iOct2Hex) ; Func Oct2Dec($iN) Local $aN, $iOct = 0 $aN = StringSplit($iN, "", 1) For $x = 1 To UBound($aN) - 1 $iOct += $aN[$x] * (8 ^ (UBound($aN) - 1 - $x)) Next Return Int($iOct) EndFunc ;==>Oct2Dec Welcome to the forums. Edited December 22, 2020 by Malkey Changed Return $iOct to Return Int($iOct) in Oct2Dec() function. Link to comment Share on other sites More sharing options...
dmca Posted August 14, 2008 Author Share Posted August 14, 2008 Thanks for all the help, I trawled through those suggestions and managed to get it going last night. Although, that method last posted seems to be a lot "cleaner" than what I ended up with. Thanks Link to comment Share on other sites More sharing options...
water Posted December 22, 2020 Share Posted December 22, 2020 You know that this topic is more than 12 years old and the OP is absent since 2011? Please do not necro old posts! My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2020 Developers Share Posted December 22, 2020 3 hours ago, water said: You know that this topic is more than 12 years old and the OP is absent since 2011? Spammer ...whom is now zapped? Earthshine and FrancescoDiMuro 1 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...
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