Jump to content

Teach me about "Search" please


Go to solution Solved by careca,

Recommended Posts

Why such GUI to spread? It flickers and disappears.

I'm not understanding??? I've tested it on windows 7 and XP and it works perfectly on both. Although I have a few extra GUI style tags I need to clean up from experimenting... it certainly doesn't flicker and disappear on me.

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...

Link to comment
Share on other sites

  • Moderators

Wombat, I understand and empathize with your motives - I recently landed a new customer by showing I have at least a baseline knowledge in a language they use (GOSU). Just be careful not to oversell yourself; you don't want to present a top notch program if you don't understand what makes it so. Whatever you end up presenting, make sure you understand the mechanics (i.e. how a GUI is built, how a search for files works, etc.), rather than presenting a wall of code you cannot explain. Good luck.

"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

Wombat, I understand and empathize with your motives - I recently landed a new customer by showing I have at least a baseline knowledge in a language they use (GOSU). Just be careful not to oversell yourself; you don't want to present a top notch program if you don't understand what makes it so. Whatever you end up presenting, make sure you understand the mechanics (i.e. how a GUI is built, how a search for files works, etc.), rather than presenting a wall of code you cannot explain. Good luck.

That is precicely why I posted a "nuts and bolts" find folders then find files script that did nothing...

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

Link to comment
Share on other sites

Wombat, I understand and empathize with your motives - I recently landed a new customer by showing I have at least a baseline knowledge in a language they use (GOSU). Just be careful not to oversell yourself; you don't want to present a top notch program if you don't understand what makes it so. Whatever you end up presenting, make sure you understand the mechanics (i.e. how a GUI is built, how a search for files works, etc.), rather than presenting a wall of code you cannot explain. Good luck.

That indeed would be extremely dumb lol.

I've already explained to my boss that I have only basic understandings of C#, C++, VisualBasic, and now a very basic understanding of Au3. Like I posted early, after demonstrating that i understand the fundementals of coding and have a strong grasp on how software is written they will be sending me to school to further my knowledge.

I'm not going to oversell because I've a daughter on the way and she needs the security this job oppurtunity can provide. I very much appreciate the consideration and the forethought to warn me though.

As well, just as I had posted early, every line of code you all post teaches me. I dont just copy and paste mindlessly, I cross reference it in the help file and practice with it, breaking the code down line by line. Wouldn't do me any good to zombie-paste, I would always be coming here for simple stuff when I could learn as I go and only bother you fine people when I have a REAL problem, or offer my help to a newbie later on.

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...

Link to comment
Share on other sites

That is precicely why I posted a "nuts and bolts" find folders then find files script that did nothing...

kylomas

What do you mean by "did nothing..." ?

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...

Link to comment
Share on other sites

It accepts user input for a folder name or drives the folder selection dialog and displays all files in that folder that meet the extention specification, then displays the files in an edit control. When you push the button to process the files it does nothing more than iterate through each file listed above. The whole thing was meant as an example of "how" to do something, it actually does nothing with the files.

More pertinent to your case is that it is not a "canned" solution that will leave you lost should something break. You actually need to understand each function (which you've shown that you are willing to do).

Have you tried it?

kylomas

edit:

I'm not going to oversell because I've a daughter on the way

Congrats, and good luck!!! Edited by 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

Link to comment
Share on other sites

Just got time to continue coding.

What I'm looking for is code that sear could flag it to search for the filename AND type as well. I believe I'll start with what careca posted and work my way down.

Edit: also, is there a way to make it search the entire directory?

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...

Link to comment
Share on other sites

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)

 

This only searches "C:" and not any folders within "C:"  correct?

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...

Link to comment
Share on other sites

Have you looked at the link provided to the UDF he suggested in that post? It will tell you what each parameter of _RecFileListToArray will do.

In this example it will search subfolders too.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Wombat,

Word to the wise. When a developer creates a UDF and provides a header (block of green text) it's advisable to read it.

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

Link to comment
Share on other sites

  • Moderators

What they said ^^. This is a part of what I was saying before. I provided a short snippet as an example of how to use the UDF. If you want to realize just how powerful it is, you have to take the time to learn how it works, and why things do what they do. That drive will only serve to help you in your new career.

"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

; #FUNCTION# ====================================================================================================================
; Name...........: _RecFileListToArray
; Description ...: Lists files andor folders in a specified path with optional recursion to defined level and result sorting
; Syntax.........: _RecFileListToArray($sPath[, $sInclude_List = "*"[, $iReturn = 0[, $iRecur = 0[, $iSort = 0[, $iReturnPath = 1[, $sExclude_List = ""[, $sExclude_List_Folder]]]]]]])
; Parameters ....: $sPath - Initial path used to generate filelist.  If path ends in then folders will be returned with an ending
;                  $sInclude_List - Optional: filter for included results (default "*"). Multiple filters must be separated by ";"
;                  $iReturn - Optional: specifies whether to return files, folders or both and omits those with certain attributes
;                             0 - Return both files and folders (Default)
;                                   If non-recursive Include/Exclude_List applies to files and folders
;                                   If recursive Include/Exclude_List applies to files only, all folders are searched unless excluded using $sExclude_List_Folder
;                             1 - Return files only    - Include/Exclude_List applies to files only, all folders searched if recursive
;                             2 - Return folders only  - Include/Exclude_List applies to folders only for searching and return
;                                 Add one or more of the following to $iReturn to omit files/folders with that attribute
;                                 + 4  - Hidden files and folders
;                                 + 8  - System files and folders
;                                 + 16 - Link/junction folders
;                                 Note:  Uses a different search algorithm and takes approx 50% longer
;                  $iRecur - Optional: specifies whether to search recursively in subfolders and to what level
;                             1 - Search in all subfolders (unlimited recursion)
;                             0 - Do not search in subfolders (Default)
;                             Negative integer - Search in subfolders to specified depth
;                  $iSort - Optional: sort ordered in alphabetical and depth order
;                             0 - Not sorted (Default)
;                             1 - Sorted
;                             2 - Sorted with faster algorithm (assumes files sorted within each folder - requires NTFS drive)
;                  $iReturnPath - Optional: specifies displayed path of results
;                             0 - File/folder name only
;                             1 - Relative to initial path (Default)
;                             2 - Full path included
;                  $sExclude_List - Optional: filter for excluded results (default ""). Multiple filters must be separated by ";"
;                  $sExclude_List_Folder - Optional: only used if $iReturn = 0 AND $iRecur = 1 to exclude folders matching the filter
 

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

I did read it, and am still. I was simply asking for information on the function of that small piece of code. Trust me, I am well aware that you all have provided more than enough information to allow for me to fish and feed myself. I am very thankful for the help.

Also I marked this as solved and set the first post that mentioned the RecFileListToArray, though I cannot think of any one post as "The Best" as you all have helped me immensely!

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...

Link to comment
Share on other sites

My last post may seem big, but when you take a look at it, and read it in sections, it's not really that big or complicated. Any doubts you have you know where we are.

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

  • 3 weeks later...

I'm sorry, I thought i marked this as solved.

I spent a little time looking throught the UDF and figured it all out. I have the code i need as well as an understanding of the functions of the _RecFileListToArray

I am very very thankful for the help from all of you.

This is my finished code :
(now I'm working on a more functional $FIleList)
 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=SCCicon.ico
#AutoIt3Wrapper_Outfile=StormCopperTSE.exe
#AutoIt3Wrapper_Res_Comment=To be used only by StormCopper
#AutoIt3Wrapper_Res_Description=Enhanced search engine
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#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)
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("SEARCH", 32, 72, 161, 57)
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   ;==>Button1Click
Func Button2Click()
    $ReadInput1 = GUICtrlRead($Input1)
    $aList = _RecFileListToArray(@HomeDrive, $ReadInput1, 1, 1, 1, 2)
    If IsArray($aList) Then
        _ArrayDisplay($aList, "$FileList")
    EndIf
EndFunc   ;==>Button2Click
Func Form1_1Close()
    Exit
EndFunc   ;==>Form1_1Close
Func Form1_1Maximize()
EndFunc   ;==>Form1_1Maximize
Func Form1_1Minimize()
EndFunc   ;==>Form1_1Minimize
Func Form1_1Restore()
EndFunc   ;==>Form1_1Restore
Func Input1Change()
EndFunc   ;==>Input1Change
Func Label1Click()
EndFunc   ;==>Label1Click
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...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...