RichE Posted January 17, 2015 Share Posted January 17, 2015 (edited) I'm writing an app to store info for elite dangerous on systems I visit and what to trade their and it's facilities, the data will sit in this structure: Data - System1 - Station1.ini Station2.ini System2 - Station1.ini Station2.ini etc etc my problem is, on initial run the data folder is created (as it should), then I populate data with said systems (which it does), and create stations (which it does), but on the search tab, when I click on a system from the list, it won't read the files in that folder for some reason, I've tested it reading from the top level and it populates. anyone got any ideas why it won't read the ini files into the combo control on the search page..? Code expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: myName Script Function: Elite Dangerous - Navigators Yoeman. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <TreeViewConstants.au3> ;declare variables $data = @ScriptDir & "\data" ;check for data dir existance, if not create it if fileexists($data) Then Else dircreate($data) EndIf #Region ### START Koda GUI section ### Form= $NYMain = GUICreate("Navigators Yeoman", 919, 559, 203, 107) $Tab1 = GUICtrlCreateTab(8, 8, 905, 505) $TabSearch = GUICtrlCreateTabItem("Search") GUICtrlSetState(-1,$GUI_SHOW) $sys_list = GUICtrlCreateList("", 16, 50 , 200, 450) $station_list = GUICtrlCreateCombo("", 220, 50, 450, 25) $TabStation = GUICtrlCreateTabItem("Add Station") $Stn_submit = GUICtrlCreateButton("Submit", 809, 476, 97, 33) GUICtrlSetColor(-1, 0x0000C0) $Sys_Select = GUICtrlCreateCombo("Select System", 16, 56, 889, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Stn_Name = GUICtrlCreateInput("Station Name", 16, 88, 449, 21) $Facilities = GUICtrlCreateGroup(" Facilities ", 16, 120, 457, 385) $cx_Repairs = GUICtrlCreateCheckbox("Repairs", 24, 138, 97, 17) $cx_Contacts = GUICtrlCreateCheckbox("Contacts", 24, 168, 97, 17) $cx_Munitions = GUICtrlCreateCheckbox("Munitions", 24, 188, 97, 17) $cx_BMarket = GUICtrlCreateCheckbox("Black Market", 24, 208, 97, 17) $cx_Outfitters = GUICtrlCreateCheckbox("Outfitters", 24, 228, 97, 17) $cx_Shipyard = GUICtrlCreateCheckbox("ShipYard", 24, 248, 97, 17) $cx_cartographer = GUICtrlCreateCheckbox("Cartographer", 24, 268, 97, 17) $cx_largepad = GUICtrlCreateCheckbox("Large Pad", 24, 288, 97, 17) $cx_mediumpad = GUICtrlCreateCheckbox("Medium Pad", 24, 310, 97, 17) $cx_Smallpad = GUICtrlCreateCheckbox("Small Pad", 24, 330, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Comments = GUICtrlCreateEdit("", 480, 88, 425, 385) GUICtrlCreateTabItem("") $Add_sys = GUICtrlCreateButton("Add System", 8, 520, 129, 33) Local $hSearch = FileFindFirstFile($data & "\*") ; Check if the search was successful, if not display a message and return False. If $hSearch = -1 Then MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.") EndIf ; Assign a Local variable the empty string which will contain the files names found. Local $sFileName = "", $iResult = 0 GUICtrlSetColor(-1, 0x0000C0) While 1 $sFileName = FileFindNextFile($hSearch) ; If there is no more file matching the search. If @error Then ExitLoop ; Display the file name. $iResult = guictrlsetdata($sys_list, $sFileName & @CR) $iResult = guictrlsetdata($Sys_Select, $sFileName) WEnd ; Close the search handle. FileClose($hSearch) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Add_sys $SN = InputBox("Add new system", "System Name") if $SN = "" or fileexists($data & "\" & $sn) then Msgbox(48,"Navigators Yeoman", "System already exists or there was an error!", 5) Else dircreate($data & "\" & $sn) msgbox(64,"Navigators Yeoman", "System Created", 5) guictrlsetdata($sys_list, $sn, $sys_list) guictrlsetdata($Sys_Select, $sn, $Sys_Select) EndIf Case $Stn_submit $sysname = guictrlread($Sys_Select) $stnname = guictrlread($Stn_Name) $Stn_coms = Guictrlread($comments) $f_Repairs = Guictrlread($cx_Repairs) $f_Contacts = Guictrlread($cx_Contacts) $f_Munitions = Guictrlread($cx_Munitions) $f_BMarket = Guictrlread($cx_BMarket) $f_Outfitters = Guictrlread($cx_Outfitters) $f_Shipyard = Guictrlread($cx_Shipyard) $f_Cartographer = Guictrlread($cx_cartographer) $f_Lpad = Guictrlread($cx_largepad) $f_Mpad = Guictrlread($cx_mediumpad) $f_Spad = Guictrlread($cx_Smallpad) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Station-Details", "Name", $stnname) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Repairs", $f_Repairs) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Contacts", $f_Contacts) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Munitions", $f_Munitions) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Bmarket", $f_BMarket) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Outfitters", $f_Outfitters) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Shipyard", $f_Shipyard) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Cartographers", $f_Cartographer) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Lpad", $f_Lpad) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "Mpad", $f_Mpad) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Facilities", "spad", $f_Spad) IniWrite($data & "\" & $sysname & "\" & $stnname &".ini", "Comments", "Comments", $Stn_coms) Case $sys_list $Sys_sel = Guictrlread($sys_list) msgbox(64,"", $Sys_sel) $nSearch = FileFindFirstFile(@ScriptDir & "\data\" & $sys_sel & "\*.ini") ; Check if the search was successful, if not display a message. If $nSearch = -1 Then MsgBox($MB_SYSTEMMODAL, "Navigators Yeoman", "Error: No Stations Found") EndIf ; Assign a Local variable the empty string which will contain the files names found. Local $nName = "", $nResult = 0 While 1 $nName = FileFindNextFile($nSearch) ; If there is no more file matching the search. If @error Then ExitLoop ; Display the file name. $nResult = GUICtrlsetdata($station_list, StringLeft($nName, stringlen($nName)-4)) WEnd ; Close the search handle. FileClose($nSearch) EndSwitch WEnd regards Rich Edited January 17, 2015 by RichE RichE [font="'Arial Narrow';"]Current projects[/font] [font="'Arial Narrow';"]are on my site [/font]Sellostring Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2015 Moderators Share Posted January 17, 2015 RichE,2 questions:- 1. Why write your own FindFirst/NextFile structure when AutoIt has several functions (FileListToArray/_FileListToArray/_FileListToArrayRec to get file lists for you without all the fuss? - 2. Does this script interact with the game itself or merely read from a file structure on disc. If you read the Forum rules (there is also a link at bottom right of each page) you will understand why I ask. 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...
RichE Posted January 17, 2015 Author Share Posted January 17, 2015 No it doesn't interact with the program it's for me to use as a sort of memo pad to keep info of where I've been. It not a game bot and i understand the forum rules, and hopefully this does not infringe them RichE [font="'Arial Narrow';"]Current projects[/font] [font="'Arial Narrow';"]are on my site [/font]Sellostring Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2015 Moderators Share Posted January 17, 2015 RichEit doesn't interact with the programDelighted to hear it. 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...
RichE Posted January 17, 2015 Author Share Posted January 17, 2015 but I'm still a bit confused as to why the inbuilt function works further up the script, but then doesn't work further down the script what I've found is if I put the select folder directly into the script it works, but if I guictrlread it in it does not, yet it msgbox's correctly out ??? $sname = Guictrlread($sys_list) msgbox(64, "" , $sname) $hSearch = FileFindFirstFile($data & "" & $sname & "*.ini") RichE [font="'Arial Narrow';"]Current projects[/font] [font="'Arial Narrow';"]are on my site [/font]Sellostring Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2015 Moderators Share Posted January 17, 2015 RichE,Use StringToBinary on the $sName string and see if there are any additional invisible characters appended to the name - that would invalidate the final path. 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...
Valuater Posted January 17, 2015 Share Posted January 17, 2015 I use this to test... msgbox(64, "" , $data & "" & $sname & "*.ini") 8) Link to comment Share on other sites More sharing options...
RichE Posted January 17, 2015 Author Share Posted January 17, 2015 Thanks guys, there was whitespace at the end, it's working now RichE [font="'Arial Narrow';"]Current projects[/font] [font="'Arial Narrow';"]are on my site [/font]Sellostring Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2015 Moderators Share Posted January 17, 2015 RichE,An old tip, but a good one. Glad it 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...
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