Sign in to follow this  
Followers 0
BatMan22

Why wont my list load? :(

7 posts in this topic

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 :)

#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

 

Share this post


Link to post
Share on other sites



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 :)

#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

 

Share this post


Link to post
Share on other sites

Double Posted - Can someone delete one of them please?

Share this post


Link to post
Share on other sites

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? :(

Share this post


Link to post
Share on other sites

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.

#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

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites

Threads merged, please stick to one in the future.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
4 hours ago, JLogan3o13 said:

Threads merged, please stick to one in the future.

Thanks, it was an accident :(

Share this post


Link to post
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
Sign in to follow this  
Followers 0