Sign in to follow this  
Followers 0
James78

Need GUI help

5 posts in this topic

#1 ·  Posted (edited)

Ok, so far I have this code here... my GUI is looking just like I want it.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 259, 309, 316, 231)
$Label1 = GUICtrlCreateLabel("Drag the files you want to analyze into the box", 8, 0, 221, 17)
$Button1 = GUICtrlCreateButton("Start", 8, 280, 65, 25, 0)
$Label2 = GUICtrlCreateLabel("below and click start. Use the Escape key anytime", 8, 16, 242, 17)
$Label3 = GUICtrlCreateLabel("during the analyzation to stop the program.", 8, 32, 204, 17)
$Label4 = GUICtrlCreateLabel("Copyright (c) 2008 James Roe", 104, 288, 146, 17)
$List1 = GUICtrlCreateList("", 8, 48, 241, 227)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

What I need to do after this, is pretty extensive, or maybe not for one of you guys who knows more than I. What I'm trying to do, is allow someone to drag and drop files of a specific type (html/htm only) from Windows Explorer (the file browser in Windows), and have every file be a separate item in the list. Every item in the list needs to be able to be deleted out of the list somehow (delete key, anything will work really). Then, when the start button is pressed, the program starts running through some code that I already have made.

However, one small hard thing, is that every item I have in the list, I need it entered into an array (full file path needed of course). $array[0] = "C:\folder\file.html", $array[1], etc. until all the files are done.

Please someone help me!! I would be appreciative of any help anyone can give me to get this done.

P.S. On that note, is there anyway to figure out the last value in an array? What I mean is like, a function to count how many arrays there are. If the array goes up to $array[45], it'll count 46.

Edited by James78

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

For counting the arrays you can use UBound and this is taken from the helpfile.

$WS_EX_ACCEPTFILES Allow an edit or input control within the created GUI window to receive filenames via drag and drop. The control must have also the $GUI_DROPACCEPTED state set by GUICtrlSetState. for other controls the drag&drop info can be retrieved with @GUI_DRAGID, @GUI_DRAGFILE, @GUIDROPID.

Also for when you click the start button use
Case $Button1
then just type your code below that Edited by dbzfanatic

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks, that should bring me a little closer to getting it done. If anyone can give any code examples, that'd help a lot too.

Edited by James78

Share this post


Link to post
Share on other sites

I can't get the case to work without errors. Also, anyone have any ideas how I can get every file path to display in the list box, and be able to be removed out of it? And I really need help with setting every file to an array.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Put the "Case" statements in the "Switch":

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
   Case $GUI_EVENT_CLOSE
      Exit
   Case $Button1
;whatever you want the button to do
EndSwitch
WEnd

For the other question regarding ListBoxes, you may want to look under the GUI_ListBox Management user defined functions.

Good luck!

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

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