Announcement

Collapse
No announcement yet.

retaining mp3 files in listbox after exit

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

  • retaining mp3 files in listbox after exit

    I recently built a mp3 player in autoplay media studio 4. I used the Listbox to load mp3 files, and then play files from the listbox. The problem, I am facing is that I would like the mp3 files locations to be retained in the listbox when the progam is exited and then reopened, just like in winamp.
    If anyone could help I'll be very gratefied to him/her.


  • #2
    Re: retaining mp3 files in listbox after exit

    Grab the list entries and write them to a Registry Setting, or to a text file. Read them back in when you start your app.

    Comment


    • #3
      Re: retaining mp3 files in listbox after exit

      After I replied to your post, I got to thinking. There really isn't a simple way to pull the information from a listbox if you're using the ItemText and ItemData.

      Here is a small script to read the contents of a list box, put the ItemText and ItemData into the delimited formats needed to do an add All and keep the config.


      --------Script to write ListBox out to Registry---------
      <IR_ACTIONS_LIST>
      <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>%Cntr%</Variable>
      <Value>0</Value>
      <Evaluate>0</Evaluate>
      </Action>
      <Action name="Get Property">
      <Type>123</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <Variable>%ListCount%</Variable>
      <ObjectName>ListBox1</ObjectName>
      <Property>Item Count</Property>
      </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>%ListVariable%</Variable>
      <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>%Cntr% &amp;lt; %ListCount%</Condition>
      </Action>
      <Action name="Get Item Data">
      <Type>121</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <TargetListBox>ListBox1</TargetListBox>
      <Index>%Cntr%</Index>
      <Variable>%ItemData%</Variable>
      </Action>
      <Action name="Get Item Text">
      <Type>117</Type>
      <Function>0</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <TargetListBox>ListBox1</TargetListBox>
      <GetType>2</GetType>
      <Index>%Cntr%</Index>
      <IndexDelimiter>;;</IndexDelimiter>
      <Variable>%ItemText%</Variable>
      <VarDelimiter>;;</VarDelimiter>
      </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>%ListVariable%</Variable>
      <Value>%ItemText%::%ItemData%</Value>
      <Evaluate>0</Evaluate>
      </Action>
      <Action name="IF">
      <Type>200</Type>
      <Function>1</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <Condition>%Cntr% != (%ListCount-1)</Condition>
      </Action>
      <Action name="Set Value">
      <Type>6</Type>
      <Function>0</Function>
      <DTIndentLevel>2</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <Variable>%ListVariable%</Variable>
      <Value>%ListVariable%;;</Value>
      <Evaluate>0</Evaluate>
      </Action>
      <Action name="END IF">
      <Type>201</Type>
      <Function>1</Function>
      <DTIndentLevel>1</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      </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>%Cntr%</Variable>
      <Value>%Cntr% + 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="Create Key">
      <Type>9</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>0</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <MainKey>3</MainKey>
      <SubKey>Software\MyMp3PLayer</SubKey>
      </Action>
      <Action name="Set Value">
      <Type>74</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <MainKey>3</MainKey>
      <SubKey>Software\MyMp3Player</SubKey>
      <ValueName>MyMp3List</ValueName>
      <ValueData>%ListVariable%</ValueData>
      <DataType>1</DataType>
      </Action>
      <Action name="Message Box">
      <Type>5</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <DialogTitle>Title</DialogTitle>
      <DialogMessage>Your question here?</DialogMessage>
      <Icon>3</Icon>
      <Variable>%Result%</Variable>
      <DialogType>0</DialogType>
      <DefaultButton>0</DefaultButton>
      </Action>
      </IR_ACTIONS_LIST>


      ---------Script to read a ListBox in from registry --------
      <IR_ACTIONS_LIST>
      <Action name="Get Value Data">
      <Type>72</Type>
      <Function>0</Function>
      <DTIndentLevel>0</DTIndentLevel>
      <Enabled>1</Enabled>
      <ErrorHandling>
      <UserNotificationMode>2</UserNotificationMode>
      <CustomErrorMessage/>
      <OnErrorAction>0</OnErrorAction>
      <JumpToLabel/>
      </ErrorHandling>
      <Variable>%RegData%</Variable>
      <MainKey>3</MainKey>
      <SubKey>Software\MyMp3Player</SubKey>
      <Value>MyMp3List</Value>
      <AutoExpand>0</AutoExpand>
      </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>0</AddType>
      <Index/>
      <ItemToAdd>%RegData%</ItemToAdd>
      <ItemDelimiter>;;</ItemDelimiter>
      </Action>
      </IR_ACTIONS_LIST>

      Comment

      Working...
      X