Sign in to follow this  
Followers 0
5471665561

Program/File Launcher

4 posts in this topic

I decided that I wanted to attempt to make a file/program launcher and could use some help on layout. I already have the basic outline set up. The plan is to hit a hotkey which triggers a window with a edit box. Then as you type in the edit box, a list appears and dynamically lists file and programs that match alphabetically based on a list from pre-designated folders. For example, if you typed "filesA", it could have "filesA", "FilesAlpha", and Filesanalysis".

I have the input gui set up and I have the string dynamically updating from the edit box as well. My issue is, what is the most effective/efficient way to have a dynamically updating list? I though about having a 2d array like so "2darray[26][100]" (assuming the first number is alphabetical) but that solution is limited to whatever static number I put in the second slot. _ArrayAdd mentions it doesn't work on 2d arrays. Is there a easier way to set up a 2d array or some other construct in alphabetical order to be shown in the GUI? I will definitely be pulling from multiple locations (music folder, movie folder, portable program folder, program folder, ect..) I just can't think of a decent way to organize multiple file lists into a single, sortable, managable variable/object.

Share this post


Link to post
Share on other sites



Hi, Durnt. How about posting the code you have already, so we can see where you're at? That will make it much easier to point you in the right direction when it comes to finishing your project :)


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

Share this post


Link to post
Share on other sites

I though about having a 2d array like so "2darray[26][100]"

So you're planning on having 2,600 field inputs? 0.o

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This is what I have at the moment.

Note: It doesn't necessarily have to be a 2d array. I was also considering a 1d array that I loop through every element and use StringInStr to see if it should be printed. Really I am just looking for opinions on the easiest way to implement the idea.

#Include <Array.au3>
#Include <File.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
hotkeyset("{F2}","test")
hotkeyset("{ESC}","exita")

;~ ;set tray icon settings
TraySetState()
TraySetToolTip("Program Starter")

;~ func checkInput() this line will be used once its working
$boxheight = 250
$boxwidth = 400
$main = GUICreate("Program Finder",$boxwidth,$boxheight,-1,-1,0x00080000,$WS_EX_APPWINDOW)
GUISetState(@SW_SHOW)
GUISetFont ( 14 ,"" , "" , "" , $main, 2 )
$edit = GUICtrlCreateEdit("",$boxwidth/4, 3, "",30,$ES_AUTOHSCROLL)

;get list of files
$FullFileList = getlist()

While 1
sleep(200)
     $Msg = GUIGetMsg()
     Switch $Msg
Case $GUI_EVENT_CLOSE
GUIDelete($main)
             ExitLoop
         Case Else
$text = GUICtrlRead ($edit)
EndSwitch

;file checking goes here
$textlist = $FullFileList

For $element In $textlist
If NOT StringInStr ( $element, $text, 2) Then
_ArrayDelete($textlist,$element)
EndIf
Next
;~ Update Gui haven't got this fully thought out
WEnd

;the following section is for testing purposes
while true
sleep(5500)
WEnd
func exita()
Exit
EndFunc
func test()
_ArrayDisplay($textlist)
EndFunc
;end testing area


Func getlist()
;D:z directory is just a sample directory that has misc worded files to test on
$testpath = 'D:z'
$filelist = _FileListToArray($testpath , "*", 1)

;this part i am unsure of. I though of having a 2d array where first array is alphabetical
;(2darray[0][0] = start of a's, [1][0] = start of b's, ect..)
;I don't know how to dynamically add to a 2d array as _ArrayAdd mentions it doesn't work. 100 for second slot is temporary
$2darray[26][100]
for $element In $filelist
If StringRegExp ( $element, "^[aA]") Then
     ;line to add element to specific array slot goes here...just blanking on it
     EndIf
    
If StringRegExp ( $element, "^[bB]") Then
     ;line to add element to specific array slot goes here...just blanking on it
     EndIf
     ;repeat if statements to fill array. I can't think of a better way, I am sure there is but I haven't scripted in a long while

     ;sort 2nd part of 2d array alphabetically
Return $2darray
EndFunc
Edited by Durnt

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