Quote:
Originally Posted by mandark15
Here's an AutoIT Envoy Packet Generator:
Code:
#include <GUIConstantsEx.au3>
Global $event, $btnGen, $envoy[9][9]
CreateGUI()
main()
Func main()
Do
$event = GUIGetMsg()
Switch $event
Case $btnGen
Local $count = 0, $pHexString = ""
For $row = 0 To 8 Step 1
For $col = 0 To 8 Step 1
If GUICtrlRead($envoy[$row][$col]) == $GUI_CHECKED Then
$count = $count + 1
$pos = ($row + $col) + ($col * 8)
$pHexString = $pHexString & FormatToHexString($pos, 8)
EndIf
Next
Next
$pHexString = "9F 00 " & FormatToHexString($count) & $pHexString
$pHexString = StringStripWS($pHexString, 2)
MsgBox(64, "Envoy Packet Copied To Clipboard", $pHexString)
ClipPut($pHexString)
Case Else
EndSwitch
Until $event = $GUI_EVENT_CLOSE
EndFunc
Func CreateGUI()
GUICreate("Envoy Packet Generator", 315, 350)
For $row = 0 To 8 Step 1
For $col = 0 To 8 Step 1
$envoy[$row][$col] = GUICtrlCreateCheckbox(" ", 30 * ($row + 1), 30 * ($col + 1))
If $row > 0 And $col > 0 And $row < 8 And $col < 8 Then
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
Next
Next
$btnGen = GUICtrlCreateButton(" Generate Packet > Copy to Clipboard ", 30, 30 * ($col + 1))
GUISetState()
EndFunc
Func FormatToHexString($data, $count = 4)
Local $t1 = Hex($data, $count), $t2 = ""
For $i = 1 To $count Step 2
$t2 = StringMid($t1, $i, 2) & " " & $t2
Next
Return $t2
EndFunc
|
This script is very helpful, but has one error:
Code:
If $row > 0 And $col > 0 And $row < 8 And $col < 8 Then
GUICtrlSetState(-1, $GUI_DISABLE)
EndIf
When I opened your script, the check box in the middle was disabled, when I removed this part, it worked. *Maybe you wanted to do something else, so, sorry for using "error" to describe this conflict
So the code is:
Code:
#include <GUIConstantsEx.au3>
Global $event, $btnGen, $envoy[9][9]
CreateGUI()
main()
Func main()
Do
$event = GUIGetMsg()
Switch $event
Case $btnGen
Local $count = 0, $pHexString = ""
For $row = 0 To 8 Step 1
For $col = 0 To 8 Step 1
If GUICtrlRead($envoy[$row][$col]) == $GUI_CHECKED Then
$count = $count + 1
$pos = ($row + $col) + ($col * 8)
$pHexString = $pHexString & FormatToHexString($pos, 8)
EndIf
Next
Next
$pHexString = "9F 00 " & FormatToHexString($count) & $pHexString
$pHexString = StringStripWS($pHexString, 2)
MsgBox(64, "Envoy Packet Copied To Clipboard", $pHexString)
ClipPut($pHexString)
Case Else
EndSwitch
Until $event = $GUI_EVENT_CLOSE
EndFunc
Func CreateGUI()
GUICreate("Envoy Packet Generator", 315, 350)
For $row = 0 To 8 Step 1
For $col = 0 To 8 Step 1
$envoy[$row][$col] = GUICtrlCreateCheckbox(" ", 30 * ($row + 1), 30 * ($col + 1))
Next
Next
$btnGen = GUICtrlCreateButton(" Generate Packet > Copy to Clipboard ", 30, 30 * ($col + 1))
GUISetState()
EndFunc
Func FormatToHexString($data, $count = 4)
Local $t1 = Hex($data, $count), $t2 = ""
For $i = 1 To $count Step 2
$t2 = StringMid($t1, $i, 2) & " " & $t2
Next
Return $t2
EndFunc
Code by
mandark15