BatMan22 Posted September 1, 2017 Share Posted September 1, 2017 I'm trying to make a form to select certain samples from a file and add it to another file.. Can't figure out why it wont work.. I tried it with and without the array, and the program just lists the file location instead of contents.. Also any chance someone has something like this already setup with each list attached to a file? Thanks all expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <File.au3> Global $aDate, $aTime $text = ClipGet() $sFileName = "\\SERVER\Server H\Staff Dropbox\blah\" & @MON & @MDAY & @YEAR & ".que" #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Choices Dialog", 345, 252, -1, -1) $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201) GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5") $Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25) $Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25) $Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25) GUICtrlSetState(-1, $GUI_DISABLE) $Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25) $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 201) $Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25) $Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25) $Clear = GUICtrlCreateButton("&Clear", 264, 225, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($ListBox1, "") GUICtrlSetData($ListBox2, "") $FileNameList = FileReadToArray($sFileName) GUICtrlSetData($ListBox1, $sFileNameList) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button6 Exit Case $Clear GUICtrlSetData($ListBox1, "") EndSwitch WEnd Link to comment Share on other sites More sharing options...
BatMan22 Posted September 1, 2017 Author Share Posted September 1, 2017 I'm trying to make a form to select certain samples from a file and add it to another file.. Can't figure out why it wont work.. I tried it with and without the array, and the program just lists the file location instead of contents.. Also any chance someone has something like this already setup with each list attached to a file? Thanks all expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <File.au3> Global $aDate, $aTime $text = ClipGet() $sFileName = "\\SERVER\Server H\Staff Dropbox\blah\" & @MON & @MDAY & @YEAR & ".que" #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Choices Dialog", 345, 252, -1, -1) $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201) GUICtrlSetData(-1, "Item1|Item2|Item3|Item4|Item5") $Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25) $Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25) $Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25) GUICtrlSetState(-1, $GUI_DISABLE) $Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25) $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 201) $Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25) $Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25) $Clear = GUICtrlCreateButton("&Clear", 264, 225, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($ListBox1, "") GUICtrlSetData($ListBox2, "") $FileNameList = FileReadToArray($sFileName) GUICtrlSetData($ListBox1, $sFileNameList) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button6 Exit Case $Clear GUICtrlSetData($ListBox1, "") EndSwitch WEnd Link to comment Share on other sites More sharing options...
BatMan22 Posted September 2, 2017 Author Share Posted September 2, 2017 Double Posted - Can someone delete one of them please? Link to comment Share on other sites More sharing options...
BatMan22 Posted September 2, 2017 Author Share Posted September 2, 2017 I kinda got it working..? By changing $FileNameList = FileReadToArray($sFileName) GUICtrlSetData($ListBox1, $sFileNameList) To: $FileNameList = FileRead($sFileName) GUICtrlSetData($ListBox1, $FileNameList) It wont loads the lines into the window, but it mashes them on one line.. Why? Link to comment Share on other sites More sharing options...
careca Posted September 2, 2017 Share Posted September 2, 2017 You're not even looping through the array... Then you changed the line to read the whole file, of course it's going all in one line. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Date.au3> #include <File.au3> Global $aDate, $aTime, $i $text = ClipGet() $sFileName = FileOpen("C:\Users\careca\Desktop\1.txt") ;"\\SERVER\Server H\Staff Dropbox\blah\" & @MON & @MDAY & @YEAR & ".que" #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Choices Dialog", 345, 252, -1, -1) $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 201) GUICtrlSetData(-1, "Item1");|Item2|Item3|Item4|Item5") $Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25) $Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25) $Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25) GUICtrlSetState(-1, $GUI_DISABLE) $Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25) $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 201) $Button5 = GUICtrlCreateButton("&OK", 104, 225, 75, 25) $Button6 = GUICtrlCreateButton("&Cancel", 184, 225, 75, 25) $Clear = GUICtrlCreateButton("&Clear", 264, 225, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($ListBox1, "") GUICtrlSetData($ListBox2, "") Local $sFileNameList = FileReadToArray($sFileName) For $i= 0 To UBound($sFileNameList)-1 GUICtrlSetData($ListBox1, $sFileNameList[$i]) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button6 Exit Case $Clear GUICtrlSetData($ListBox1, "") EndSwitch WEnd Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 2, 2017 Moderators Share Posted September 2, 2017 Threads merged, please stick to one in the future. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
BatMan22 Posted September 2, 2017 Author Share Posted September 2, 2017 4 hours ago, JLogan3o13 said: Threads merged, please stick to one in the future. Thanks, it was an accident 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