Jump to content

Help me create GUI splitting string in hex code and set the data to list


Recommended Posts

  • Moderators

sammy1996,

Welcome to the AutoIt forums.

What code have you tried that has not worked?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

9 minutes ago, Melba23 said:

sammy1996,

Welcome to the AutoIt forums.

What code have you tried that has not worked?

M23

 

hi you, i need a tool that can fetch strings and set to list in GUI. You can help me complete it, I thank you very much

Link to comment
Share on other sites

  • Moderators

sammy1996,

We do not write code to order - we help you get your code working correctly. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers.

So I again ask what you have tried for yourself.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

my script

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:

 Script Function: Template AutoIt script.

#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
;-----------------------------------------------------------------------------------
$Form = GUICreate("Read file dat", 270, 328, 349, 199)
$Input = GUICtrlCreateInput("", 15, 8, 235, 20)
$Progress = GUICtrlCreateProgress(15, 40, 235, 20)
$Browse = GUICtrlCreateButton("Browse", 16, 72, 75, 25)
$Cancel = GUICtrlCreateButton("Cancel", 176, 72, 75, 25)
$List = GUICtrlCreateInput("", 16, 112, 235, 200)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Browse
        $Dialog = FileOpenDialog("Browse File Model .DAT", @ScriptDir & "\", "Model (*.DAT)")
        $FileOpen = FileOpen($Dialog,16)
        $FileRead = FileRead($FileOpen)
        If @error Then
            FileChangeDir(@ScriptDir)
        Else
            $RInput = ""
            GUICtrlSetData($Input, $RInput)
            $RStart = 0
            GUICtrlSetData($Progress, $RStart)
        For $Start = 0 To 100
        Next
            GUICtrlSetData($Progress, $Start)
            Sleep(1000)
            GUICtrlSetData($Input, $Dialog)
;----------------------------------------------
            $Split = StringSplit($FileRead,"00")
            GUICtrlSetData($List, $FileOpen)
        EndIf
        Case $Cancel, $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

my I have to do at filename and get temp and temp and name in model.dat file

Link to comment
Share on other sites

  • Moderators

sammy1996,

If the string are always "Temp" and "Name" why do you need to extract them? If the strings can very, how do you determine what is a string and what is not within the file content?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

The model.dat file is for example, I need to read other .dat files that identify and extract all strings of such form into the list of GUIs.
For example here I have image link : Link image
I need to identify the name of the string by looking for "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" and ignore a trailing edge. go left, then take the name of the example string as Temp or Name as the image link on the title and extract the string name into GUICtrlSetData ($ List, $ FileOpen)
Link to comment
Share on other sites


I have finished 
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:

 Script Function: Template AutoIt script.

#ce ----------------------------------------------------------------------------
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=
;-----------------------------------------------------------------------------------
$Form = GUICreate("Read file dat", 270, 328, 349, 199)
$Input = GUICtrlCreateInput("", 15, 8, 235, 20)
$Progress = GUICtrlCreateProgress(15, 40, 235, 20)
$Browse = GUICtrlCreateButton("Browse", 16, 72, 75, 25)
$Cancel = GUICtrlCreateButton("Cancel", 176, 72, 75, 25)
$List = GUICtrlCreateInput("", 16, 112, 235, 200)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Browse
        $Dialog = FileOpenDialog("", @ScriptDir & "\", "All (*.*)")
        $FileOpen = FileOpen($Dialog,16)
        $FileRead = FileRead($FileOpen)
        If @error Then
            FileChangeDir(@ScriptDir)
        Else
            $RInput = ""
            GUICtrlSetData($Input, $RInput)
            $RStart = 0
            GUICtrlSetData($Progress, $RStart)
        For $Start = 0 To 100
        Next
            GUICtrlSetData($Progress, $Start)
            Sleep(1000)
            GUICtrlSetData($Input, $Dialog)
            $Hex = StringRegExp($FileRead,"(.*?)00(.*?)01000000000000000000000000000000010000000200000001000000",1)
            $String = _HexToString($Hex[1])
            GUICtrlSetData($List, $String)
        Next
        EndIf
        Case $Cancel, $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

but there is a problem with this

$Hex = StringRegExp($FileRead,"(.*?)00(.*?)01000000000000000000000000000000010000000200000001000000",1)

 
I want it to run from the beginning of the line until the end of the line and extract the second hex
(.*?)00(.*?)

convert that second hex into a string
$String = _HexToString($Hex[1])

 

set data in

GUICtrlSetData($List, $String)

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...