| View previous topic :: View next topic |
| Author |
Message |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Sat Mar 13, 2010 7:38 pm Post subject: No array elements to hex? |
|
|
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 |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Sat Mar 13, 2010 7:50 pm Post subject: |
|
|
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 |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
Posted: Sat Mar 13, 2010 9:00 pm Post subject: |
|
|
| 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 |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
|
| Back to top |
|
 |
|