Jump to content
Sign in to follow this  
Wombat

Teach me about "Search" please

Recommended Posts

Wombat

so now I know how to add functions to buttons, thanks to members here on the forums.

Now I need help with understanding and using the Search function.

What I'm tring to accomplish: Create a small .exe that will display a message box that will allow for input, upon pressing the search button the script seaches an entire directory for similar files and pops up a secondary msg box displaying the results.

At this point in the learning stage I'm in need of a quick explanation of the search function, I read the Help file but its not helping with what I'm trying to do. If there's already a post on this or a set of pages that will show me how in the Help file then please by all means Mods delete this thread and point me in the right direction.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Pictures\StormCopper_Icon.ico
#AutoIt3Wrapper_Outfile=StormCopperTSE.exe
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
#Region ### START Koda GUI section ### Form=C:\Users\Wombat\StormCopper Work\stormcopper search engine.kxf
$Form1_1 = GUICreate("Trumpf500 Search Engin", 312, 149, 753, 520, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1_1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1_1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1_1Restore")
$Label1 = GUICtrlCreateLabel("Trumpf500 Search Engine", 8, 8, 213, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetOnEvent(-1, "Label1Click")
$Input1 = GUICtrlCreateInput("Program Number", 8, 40, 209, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
$Button2 = GUICtrlCreateButton("Button2", 32, 72, 161, 57, $BS_ICON)
GUICtrlSetImage(-1, "C:\Users\Wombat\Pictures\search.ico", -1)
GUICtrlSetOnEvent(-1, "Button2Click")
$Button1 = GUICtrlCreateButton("Close", 248, 8, 59, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Button1Click()
Exit
EndFunc
Func Button2Click()
EndFunc
Func Form1_1Close()
Exit
EndFunc
Func Form1_1Maximize()
EndFunc
Func Form1_1Minimize()
EndFunc
Func Form1_1Restore()
EndFunc
Func Input1Change()
EndFunc
Func Label1Click()
EndFunc

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Melba23

Wombat,

I suggest searching for the correct place to post should be your main aim at the moment - thread moved from "Dev Chat". ;)

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MouseSpotter

Add function to button = Google "autoit button click event"

Then follow the examples.

Share this post


Link to post
Share on other sites
careca

What you need is this:

InputBox ( "Title", "Problem?")

Msgbox doesn't allow input.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

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

Au3Record.exe

Share this post


Link to post
Share on other sites
Wombat

What you need is this:

InputBox ( "Title", "Problem?")

Msgbox doesn't allow input.

Have you looked at the code I posted?

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
careca

Sorry man, it's late and i should be sleeping by now, only read part of it, and didn't try the code, what should the script search?

Similar files mean what? extension? size? name?


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

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

Au3Record.exe

Share this post


Link to post
Share on other sites
careca

Ok, i think this might help, searches for all "au3" files in the script dir, check it out, you need an include:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Pictures\StormCopper_Icon.ico
#AutoIt3Wrapper_Outfile=StormCopperTSE.exe
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <RecFileListToArray.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM)
#Region ### START Koda GUI section ### Form=C:\Users\Wombat\StormCopper Work\stormcopper search engine.kxf
$Form1_1 = GUICreate("Trumpf500 Search Engin", 312, 149, 753, 520, -1, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE))
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1_1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1_1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1_1Restore")
$Label1 = GUICtrlCreateLabel("Trumpf500 Search Engine", 8, 8, 213, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetOnEvent(-1, "Label1Click")
$Input1 = GUICtrlCreateInput("*.au3", 8, 40, 209, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
$Button2 = GUICtrlCreateButton("Button2", 32, 72, 161, 57, $BS_ICON)
GUICtrlSetImage(-1, "C:\Users\Wombat\Pictures\search.ico", -1)
GUICtrlSetOnEvent(-1, "Button2Click")
$Button1 = GUICtrlCreateButton("Close", 248, 8, 59, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Button1Click()
Exit
EndFunc
Func Button2Click()
$ReadInput1 = GUICtrlRead($Input1)
$aList = _RecFileListToArray(@ScriptDir, $ReadInput1, 1, 1, 1, 2)
If IsArray($aList) Then
_ArrayDisplay($aList, "$FileList")
EndIf
EndFunc
Func Form1_1Close()
Exit
EndFunc
Func Form1_1Maximize()
EndFunc
Func Form1_1Minimize()
EndFunc
Func Form1_1Restore()
EndFunc
Func Input1Change()
EndFunc
Func Label1Click()
EndFunc
Edited by careca
  • Like 1

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

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

Au3Record.exe

Share this post


Link to post
Share on other sites
Wombat

Same here, I'm working a 16 hour work day and then going home and trying write a small .exe that will act as a standalone search engine for my boss, ( there's a $25 raise and a promotion in it if I succeed) and I'm about to keel over from exhaustion.

Basically I want to be able to input a filename, have the script look to see if it exists, if so present the user with a few options, if not then simply display a messagebox stating no such file exists. I just need a point in the right direction and some help now and again with better coding practices. Btw you all ROCK!


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
JLogan3o13

I'm not sure you need all that GUI goodness to do what you're describing (you can certainly build the GUI around it, once you learn the mechanics). I would suggest using Melba's' RecFileListToArray: http://www.autoitscript.com/forum/index.php?showtopic=126198. Something like this should get you started:

#include <Array.au3>
#include <RecFileListToArray.au3>

$var = InputBox("Search Engine", "Please enter the name of the file you're looking for")
$dir = FileSelectFolder("Search Engine", "C:\")

Local $aArray = _RecFileListToArray($dir, $var & "*", 1, 1, 1, 2)
 _ArrayDisplay($aArray)
  • Like 1

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

Share this post


Link to post
Share on other sites
guinness

Start small work big. That's my approach.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
careca

I generally let those kind of decisions to the OP, so i only added, basically what you posted to his gui, it reads whatever you write in the input field and searches for it.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

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.

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

Au3Record.exe

Share this post


Link to post
Share on other sites
JLogan3o13

Start small work big. That's my approach.

Amen. I always leave user interface to some point near the end of development.


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

Share this post


Link to post
Share on other sites
Wombat

I generally let those kind of decisions to the OP, so i only added, basically what you posted to his gui, it reads whatever you write in the input field and searches for it.

And this is exactly what I need NOW. Once I demo a working program in less than a month the company is going to pay my way through programming school just for showing I understand the basics, then offer me a job in application development.

Amen. I always leave user interface to some point near the end of development.

I normally work the same way, as it only makes sense from a logical viewpoint. But I have less than a month to get this and a powerpoiint presentation together. If I succeed in this small thing I'll be given more time and money to begin the long process of coding from the ground up.

I understand most of the code, I just need help in my technique of applying it. Which I could acquire through mimicry over time but as I stated I only have a month. I appreciate all of your help and autoit has become my new scripting language of choice until I take training in others.

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
kylomas

Wombat,

Answer careca's question

what should the script search?

Similar files mean what? extension? size? name?

and you'll get better advice.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Wombat

Wombat,

Answer careca's question

and you'll get better advice.

kylomas

Reread post #8


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
kylomas

Reread post #8

Hmmm....now where the hell did I put that brain...?

You may be able to adapt this code written for a different topic. The code is pretty much self evident. If you need to filter by filename/pattern (other than extention) than you'll need to incorporate what JLogan3O13 posted (#9).

; *** Start added by AutoIt3Wrapper ***
#include <WindowsConstants.au3>
; *** End added by AutoIt3Wrapper ***

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <array.au3>

#AutoIt3Wrapper_Add_Constants=n

local $gui010   =   guicreate('',900,600)
local $aSize    =   wingetclientsize($gui010)
                    guisetfont(8.5,600)
                    guictrlcreatelabel('Folder',            020,020,050,20)
local $inp010   =   guictrlcreateinput('',                  070,020,470,20)
local $btn010   =   guictrlcreatebutton('...',              560,020,20,20)
                    guictrlcreatelabel('Files Selected',    020,050,200,20)
local $edt010   =   guictrlcreateedit('',                   020,070,$asize[0]-40,200,bitor($es_readonly,$ws_vscroll,$ws_hscroll))
                    guictrlcreatelabel('Log',               020,290,200,20)
local $edt020   =   guictrlcreateedit('',                   020,310,$asize[0]-40,200,bitor($es_readonly,$ws_vscroll,$ws_hscroll))
local $btn020   =   guictrlcreatebutton('Do Something With The Files Listed',20,$asize[1]-30,$asize[0]-40,20)
                    guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
        case $btn010
            guictrlsetdata($edt010,chk_folder(''))
        case $inp010
            guictrlsetdata($edt010,chk_folder(guictrlread($inp010)))
        case $btn020
            if stringlen(guictrlread($inp010)) = 0 then
                guictrlsetdata($edt010,chk_folder(guictrlread($inp010)))
            Else
                Process_Files(guictrlread($edt010))
            endif
    EndSwitch
WEnd


func chk_folder($str)

    if fileexists($str) = 0 then

        $folder = FileSelectFolder("Choose a folder.", $str)
        if @error = 1 then
            guictrlsetdata($edt020,'Folder Selection terminated' & @crlf,1)
            guictrlsetdata($inp010,'')
            guictrlsetstate($inp010,$gui_focus)
            Return ''
        endif

        guictrlsetdata($edt020,'Processing folder = ' & $folder & @crlf,1)
        guictrlsetdata($inp010,$folder)

    Else

        $folder = guictrlread($inp010)

    endif

    return get_files($folder)

endfunc

func get_files($str)

    if stringright($str,1) <> '\' then $str = $str & '\'

    local $files, $afiles
    $files = FileOpenDialog('Select Files',$str,'Text (*.txt))|ALL (*.*)',4)

    if stringinstr($files,'|') = 0 then
        $afiles = stringsplit($files,'\')
        return $afiles[ubound($afiles) - 1]
    else
        $afiles = stringsplit($files,'|')
        return _arraytostring($afiles,@crlf,2,ubound($afiles) - 1)
    endif

endfunc

func Process_Files($str)

    ; here's where you do your thing...

    $afiles = stringsplit($str,@crlf,1)

    for $1 = 1 to $afiles[0]

        ; I'm just displaying the files as they are found in the array...do whatever you want

        guictrlsetdata($edt020,'I just did something for file = ' & $afiles[$1] & @crlf,1)
    Next

endfunc

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Wombat

I appreciate the link

Though the entire point of writing the program myself is to demonstrate that I have a basic understanding of coding languages to my boss . Presenting him with that program might solve a tiny problem for him but doesn't benefit the task at hand any. Again thank you though.


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
AZJIO

Why such GUI to spread? It flickers and disappears.

Share this post


Link to post
Share on other sites
Wombat

Alright, I believe I have enough to work it out on my own, if not I'll return with more questions for you all. Thank you for the help so far.


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

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  

×