AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

No array elements to hex?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Sat Mar 13, 2010 7:38 pm    Post subject: No array elements to hex? Reply with quote

Wondering why the elements will not auto convert to hex. Look at this example
Code:
nums = 84 104 105 115 32 118 101 114 115 105 111 110 32 104 97 115 32 101 120 105 112 114 101 100 33 10 80 108 101 97 115 101 32 69 109 97 105 108 32 109 101 32 102 111 114 32 97 110 32 117 112 100 97 116 101 100 32 118 101 114 115 105 111 110 46
StringSplit, chrs, nums, %A_Space%
Loop % chrs0
{
   setformat, Integerfast, D
   msgbox % "Array element: " A_Index . "`nElement contents: " . curNum := chrs%A_Index%
   msgbox % "Setformat function returns: " ascHex(curNum)
}
return

ascHex(var){
   setformat, Integerfast, Hex
   return var
}
Any advice is greatly appreciated while I go read about pseudo arrays again.
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Sat Mar 13, 2010 7:50 pm    Post subject: Reply with quote

Converting the current element to a pointer seems to resolve the auto conversion part.
Code:
*curNum := (chrs%A_Index%)
I kind of need this urgently so this is going to be good enough for now..
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Sat Mar 13, 2010 9:00 pm    Post subject: Reply with quote

AHK Help File wrote:
SetFormat
Sets the format of integers and floating point numbers generated by math operations.

Code:
nums = 84 104 105 115 32 118 101 114 115 105 111 110 32 104 97 115 32 101 120 105 112 114 101 100 33 10 80 108 101 97 115 101 32 69 109 97 105 108 32 109 101 32 102 111 114 32 97 110 32 117 112 100 97 116 101 100 32 118 101 114 115 105 111 110 46
StringSplit, chrs, nums, %A_Space%
Loop % chrs0
{
   setformat, Integerfast, D
   msgbox % "Array element: " A_Index . "`nElement contents: " . curNum := chrs%A_Index%
   msgbox % "Setformat function returns: " ascHex(curNum)
}
return

ascHex(var){
   setformat, Integerfast, Hex
   return var + 0
}
Back to top
View user's profile Send private message Visit poster's website
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Sat Mar 13, 2010 10:48 pm    Post subject: Reply with quote

Thanks again my friend Wink!
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group