Announcement

Collapse
No announcement yet.

Using The Search Option To Find Files Containg Keywords, and display in listbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using The Search Option To Find Files Containg Keywords, and display in listbox

    Hey, I posted a question last night, and it was answered, but unfortunately it was all through private message, so I want to share. Derek gave me all of this code, as well as an idea of how to use it. You will have to change two of the lines in it to make it work for you, but it seems quite easy.
    You will need am edit box, a search button of some sort(text or image etc.), and a listbox. Simply copy and paste the code below into the actions tab of your button.....

    <IR_ACTIONS_LIST>
    <Action name="Get Text">
    <Type>78</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%ObjectText%</Variable>
    <ObjectName>EditField1</ObjectName>
    </Action>
    <Action name="Search">
    <Type>18</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Files%</Variable>
    <Delimiter>;;</Delimiter>
    <FileName>*%ObjectText%*.mp3</FileName>
    <LocalFixedDrives>0</LocalFixedDrives>
    <RemoteDrives>0</RemoteDrives>
    <RemovableDrives>0</RemovableDrives>
    <CDROMDrives>0</CDROMDrives>
    <SpecificDirectoriesDrives>1</SpecificDirectoriesDrives>
    <CustomDirectoriesDrives>D:\Music\mp3\Singles</CustomDirectoriesDrives>
    <RecurseCustom>0</RecurseCustom>
    <DialogTitle>Searching for Files</DialogTitle>
    <DialogText>Searching for files. This may take a few moments.</DialogText>
    <ShowDialog>1</ShowDialog>
    </Action>
    <Action name="Count Delimited Strings">
    <Type>63</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%FileCount%</Variable>
    <Source>%Files%</Source>
    <Delimiter>;;</Delimiter>
    </Action>
    <Action name="Set Value">
    <Type>6</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%w%</Variable>
    <Value>0</Value>
    <Evaluate>0</Evaluate>
    </Action>
    <Action name="WHILE">
    <Type>204</Type>
    <Function>1</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Condition>%w% &amp;lt;= %FileCount%</Condition>
    </Action>
    <Action name="Get Delimited String">
    <Type>64</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Full_Path%</Variable>
    <Source>%Files%</Source>
    <Delimiter>;;</Delimiter>
    <ItemIndex>%w%</ItemIndex>
    </Action>
    <Action name="Parse Path">
    <Type>62</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Filename%</Variable>
    <Source>%Full_Path%</Source>
    <ParseType>4</ParseType>
    </Action>
    <Action name="Add">
    <Type>111</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <TargetList>files</TargetList>
    <AddType>1</AddType>
    <Index/>
    <Text>%Filename%</Text>
    <Delimiter>;;</Delimiter>
    </Action>
    <Action name="Set Value">
    <Type>6</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%w%</Variable>
    <Value>%w% + 1</Value>
    <Evaluate>1</Evaluate>
    </Action>
    <Action name="END WHILE">
    <Type>205</Type>
    <Function>1</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    </Action>
    <Action name="Get Item">
    <Type>112</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <TargetList>files</TargetList>
    <GetType>1</GetType>
    <Index/>
    <IndexDelimiter>;;</IndexDelimiter>
    <Variable>%ListItem%</Variable>
    <VarDelimiter>;;</VarDelimiter>
    </Action>
    <Action name="Add">
    <Type>118</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <TargetListBox>ListBox1</TargetListBox>
    <AddType>1</AddType>
    <Index/>
    <ItemToAdd>%ListItem%</ItemToAdd>
    <ItemDelimiter>;;</ItemDelimiter>
    </Action>
    </IR_ACTIONS_LIST>

    Then, cut and paste this into the actions tab of your list box.

    <IR_ACTIONS_LIST>
    <Action name="Get Item Text">
    <Type>117</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <TargetListBox>ListBox1</TargetListBox>
    <GetType>0</GetType>
    <Index/>
    <IndexDelimiter>;;</IndexDelimiter>
    <Variable>%ItemText%</Variable>
    <VarDelimiter>;;</VarDelimiter>
    </Action>
    <Action name="Load">
    <Type>105</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <MP3File>D:\Music\mp3\Singles\%ItemText%</MP3File>
    <External>1</External>
    </Action>
    <Action name="Play">
    <Type>106</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    </Action>
    </IR_ACTIONS_LIST>

    You can change the path the search looks in easy enough by looking in your search buttons action tab(line 2).
    I have mine temporarily set to fixed drives, where it unneccesarily searches the whole hard drive. In the list box action tab, you can change the location of your mp3s under the second line(mp3.Load). This is one of the setbacks I've found, is that you have put all of the mp3s into one folder, as although it will find and display them in the listbox, when it tries to load and play them, it cannot find them if they are all in one folder. In other words, you cant put c:\songs assuming that will find the song you are looking for inside a subdirectory. I'm sure that someone with a bit of experience could solve this problem(and if you do, let me know). I have removed the mp3 play action from the listbox, and added a play button to my page, so that I can browse the songs found without changing the one playing. I am trying to find a way to add the files found into a playlist(by clicking an add button). This way, I could search for the songs I want, and have them load into a currently playing playlist. Problem: I don't know exactly what I'm doing [img]/ubbthreads/images/icons/smile.gif[/img]
    If I figure it out, I'll post it here, and if you know, please do the same.
    Thank-you to Derek, who replied to my question within an hour, and whipped up this very helpful search............thing.

  • #2
    Re: Using The Search Option To Find Files Containg Keywords, and display in listbox

    There are a lot of things that can be added to this project to make it more functional, but this should give you a good base to go off from.

    Get it here

    Comment


    • #3
      Re: Using The Search Option To Find Files Containg Keywords, and display in listbox

      Go - DJ! Go - DJ! And so forth...

      Corey Milner
      Creative Director, Indigo Rose Software

      Comment

      Working...
      X