Leaderboard
Popular Content
Showing content with the highest reputation on 08/16/2021 in all areas
-
regex to prepend '0x' to string chunks
pixelsearch and one other reacted to mikell for a topic
Of course there is. Don't forget the 4th parameter of the SRE function #include <array.au3> $str = "0x03f477ffa50245" Local $aArray = StringRegExp(StringRegExpReplace ($str, "\w{2}", "0x$0"), "\w{4}", 3, 5) _ArrayDisplay($aArray) Edit It could (should ?) also be done using the correct syntax Local $aArray = StringRegExp(StringRegExpReplace ($str, "[[:xdigit:]]{2}", "0x$0"), ".{4}", 3, 3)2 points -
regex to prepend '0x' to string chunks
Gianni and one other reacted to JockoDundee for a topic
Local $aArray=StringRegExp(StringRegExpReplace($sString, $sPattern, "0x$1"), "\w{5}", 3)2 points -
regex to prepend '0x' to string chunks
markyrocks reacted to 636C65616E for a topic
That's basicaly what i wanted to say (but sometimes i refrain myself this kind of comment ^^), but it is done with some optimized compiled code, so it's far faster than a native AutoIt loop. Anyway if you want to split your data (as numbers) into some AutoIt array, you will need to loop through it at a moment or another. Well it's just the state, the toggling is handled when the key_down 'event' is fired. You pressed: it toggle, but as long as you hold the key it's still down ... It's just about the bit (low or high order, 'righter' or 'lefter'), there's no hex cutoff or stuff like that (also 0x8 will be nor toggled nor down, it is a bitmask) (you can see in my code i handle the stuff by cheking the bits themself)1 point -
AutoIt Snippets
Exit reacted to argumentum for a topic
I needed _DateDiff() to include milliseconds. ConsoleWrite('>>> ' & _DateDiffMs('2021/08/16 13:25:08.727', '2021/08/16 13:25:08.729') & @CRLF) Func _DateDiffMs($sDate1st, $sDate2nd) Local $iDate1st, $aDate1st = StringSplit($sDate1st, ".") ReDim $aDate1st[3] Local $iDate2nd, $aDate2nd = StringSplit($sDate2nd, ".") ReDim $aDate2nd[3] Local $iDate1st = _DateDiff('s', '1970/01/01 00:00:00', $aDate1st[1]) Local $iDate2nd = _DateDiff('s', '1970/01/01 00:00:00', $aDate2nd[1]) $iDate1st &= "000" $iDate2nd &= "000" $iDate1st += Int($aDate1st[2]) $iDate2nd += Int($aDate2nd[2]) Return ( $iDate2nd - $iDate1st ) / 1000 EndFunc1 point -
zPlayer - My own little audio/video player
CYCho reacted to carlvanwormer for a topic
OK, I think you've given me all the pieces I need to work with over the next week. I'll report the results of my hack/mods as I polish the code framework. Thanks for your great contribution to my dad's new home entertainment system.1 point -
regex to prepend '0x' to string chunks
Gianni reacted to markyrocks for a topic
Chimp after looking through the getkybdstate function documentation I'm not so sure you're getting the correct data out of it. Or maybe not the data you think you're supposed to be getting. It really seems like you should be shuffling through the struct byte by byte and it looks like the value should be either a 1, a 0 or 128 depending on the type of key and the state. I'm guess that the index+1 corresponds to the virtual key code. 0-254 being all the keys on an ascii keyboard. Edit. Scratch that I saw what you posted in a different thread. I'm not sure why you are interested in adding "0x" to everything. A byte is just a number between 0-255. Whether it looks like 0000 0001 0x01 or 1 really shouldn't make a bit of difference. An unsigned byte anyways a signed byte is probably -128 to 128. Not 100% on that tho highlydoubtful that these are signed.1 point -
regex to prepend '0x' to string chunks
636C65616E reacted to JockoDundee for a topic
A couple couple of thoughts here. 1) For solution evaluation, I prefer to play @NineBall. Which means I use an informal series of Nine’s dicta, asides and snarks from past topics, as my guide. In this case, since a) performance is not mentioned as a req b) no comprehensive data set is available then the controlling rule would be “One-liners win”. 2) A native loop might be fast, but the Autoit interpretive For loop is not such an animal. 3) The PCRE engine on the other hand is, AFAIK, written in native compiled code. 4) The data in the example is trivial though. I would expect with longer strings would come even more performance disparity.1 point -
regex to prepend '0x' to string chunks
Gianni reacted to 636C65616E for a topic
#include <array.au3> $str = '123456789' $arr = StringRegExp($str, '\w{3}', 3) for $i = 0 to UBound($arr)-1 $arr[$i] = '0x' & $arr[$i] next _ArrayDisplay($arr) $tmp = StringRegExpReplace($str, '(\w{3})', '0x$0 ') ConsoleWrite($tmp & @CRLF) Oupsi @Subz was a bit faster Anyway it may be possible with PCRE backtracking (with stuff like (*ACCEPT) or (*COMMIT)) but I'm not sure1 point -
Not without looping through the array or just getting the results as a string. Local $sString = StringRegExpReplace($sString, $sPattern, "0x\0" & @CRLF) ConsoleWrite($sString & @CRLF)1 point
-
The results are returning in JSON format. I would use this to parse the results --1 point
-
a possible way #include <WinAPISys.au3> ; _WinAPI_GetKeyboardState fails if there is not a GUI $hGUI = GUICreate("Test _WinAPI_GetKeyboardState") GUISetState() KeyBoard_WaitForModifierKeysUp() ; returns when Shift,Ctrl,Alt,LWin,RWin ar all UP MsgBox(0, '', "All modifier Keys are Up") Func KeyBoard_WaitForModifierKeysUp() Local $aKeyboardState Do $aKeyboardState = StringRegExp(StringTrimLeft(DllStructGetData(_WinAPI_GetKeyboardState(), 1), 2), "\w{2}", 3) ConsoleWrite("Debug: " & $aKeyboardState[16] & ' ' & $aKeyboardState[17] & ' ' & $aKeyboardState[18] & ' ' & $aKeyboardState[91] & ' ' & $aKeyboardState[92] & @LF) Sleep(50) Until (Not (BitAND(0x80, BitOR( _ "0x" & $aKeyboardState[16], _ ; Shift "0x" & $aKeyboardState[17], _ ; Ctrl "0x" & $aKeyboardState[18], _ ; Alt "0x" & $aKeyboardState[91], _ ; LWin "0x" & $aKeyboardState[92])))) ; RWin EndFunc ;==>KeyBoard_WaitForModifierKeysUp1 point
-
1 point
-
1 point