sammy1996 Posted March 18, 2018 Share Posted March 18, 2018 I need a tool that can read the Model.dat file and retrieve all the strings as shown and then set the data into the list in the GUI. ThanksImage Link Model.dat Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 18, 2018 Moderators Share Posted March 18, 2018 sammy1996, Welcome to the AutoIt forums. What code have you tried that has not worked? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sammy1996 Posted March 18, 2018 Author Share Posted March 18, 2018 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 More sharing options...
sammy1996 Posted March 18, 2018 Author Share Posted March 18, 2018 I need to take the two strings is Temp and Name as shown above and set to the list of GUI Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 18, 2018 Moderators Share Posted March 18, 2018 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sammy1996 Posted March 18, 2018 Author Share Posted March 18, 2018 my script expandcollapse popup#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 More sharing options...
Moderators Melba23 Posted March 18, 2018 Moderators Share Posted March 18, 2018 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sammy1996 Posted March 18, 2018 Author Share Posted March 18, 2018 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 More sharing options...
Bilgus Posted March 18, 2018 Share Posted March 18, 2018 @sammy1996 I think this should give you an Idea of how to do it Link to comment Share on other sites More sharing options...
sammy1996 Posted March 18, 2018 Author Share Posted March 18, 2018 1 : find for hex "01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 02 00 00 00 01 00 00 00" for length "28" link image for example 2: get string name from right to the left - for example "Temp" or "Name" and extract it to GUICtrlSetData ($List, $FileOpen) Link to comment Share on other sites More sharing options...
Bilgus Posted March 18, 2018 Share Posted March 18, 2018 here is another example for you that is a little closer to your situation Link to comment Share on other sites More sharing options...
sammy1996 Posted March 19, 2018 Author Share Posted March 19, 2018 I have finished expandcollapse popup#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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now