Announcement

Collapse
No announcement yet.

List Box

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

  • List Box

    I have added 5 items in the List Box Items. I want the user to be able to click on an item and view a PDF file. There will be five different PDF files, one for each list item.
    At the moment I cannot find a way to associate a single PDF with a single list item. I have tried to select an item under the "Settings" tab, go to the "Actions" tab and under "Available Actions" select the file I want to open. However, this appears to apply to every item in the list. I have checked the documentation but clearly I have missed something.
    Please help.
    Regards
    Andrew

  • #2
    Re: List Box

    I am also having the same problem. To test this, I am putting 5 items in the list box and attempting to assign a separate Execute File action for each item. I get the same as Andrew, the function will work for all items in the list. I cannot find to a way to distinguish the items to do separate actions. Do I need to write an IF statement or something for each item?

    Comment


    • #3
      Re: List Box

      The List Box object actually allows you to associate a data member with each item. You do this by following the item's text with a double colon. So, you could make a List Box | Add action that adds:

      Document1::%SrcDir%\doc_one.pdf;;Document2::%SrcDi r%\doc_two.pdf

      Now, go to the On Double-Click action for the List box and get the selected item using the Get Selected action. Then use the Get Item Data action to get the item's data. This will be the path to the file associated with the item.

      Here is a List Box object that I have copied to my clipboard that will illustrate this. Copy this text to your clipboard and then paste it into AMS40 as a new object:


      Untitled

      9
      ListBox1
      1
      1
      0
      0

      0

      62
      365
      166
      419


      0
      0


      On Selection Changed


      On Double-click

      126
      0
      0
      1

      2

      0


      ListBox1
      %SelectedIndex%
      ;;


      121
      0
      0
      1

      2

      0


      ListBox1
      %SelectedIndex%
      %ItemData%


      5
      0
      0
      1

      2

      0


      Item Data
      The item's data is:

      %ItemData%

      2
      %Result%
      0
      0



      Item One:ATA1;;Item Two:ATA2
      0
      16777215
      0
      Arial
      Regular
      0
      14
      400
      0
      0
      0
      1


      1
      1
      1
      0
      1
      0



      Comment


      • #4
        Re: List Box

        See this post for an example page that you can import.

        - Brett

        Comment


        • #5
          Re: List Box

          Brett,
          I have followed your instructions, or at least, I think I have, and I am still missing something.
          In the Settings tab I have typed the viewable name followed by two colons and the name of the PDF eg:

          First PDF::%SrcDrv%\MyPDF.pdf

          In the actions tab I have:

          %ItemData% = ListBoxObject(PDF List).GetItemData (0)
          %SelectedIndex% = ListBoxObject(PDF List).GetSelected
          File.Open = (open, "%SelectedIndex%")

          Presumably I need File.Open somewhere. Can you help please?

          Comment


          • #6
            Re: List Box

            You have the actions reversed and a bit wrong. Try:

            In the actions tab I have:

            %SelectedIndex% = ListBoxObject(PDF List).GetSelected
            %ItemData% = ListBoxObject(PDF List).GetItemData (%SelectedIndex%)
            File.Open = (open, "%SelectedIndex%")

            Comment


            • #7
              Re: List Box

              I have one for you, Brett. Once I have gathered all desired files from a directory, how would I go about counting the number of files and displaying the number in another text field?

              Comment


              • #8
                Re: List Box

                Brett,
                When using my beta product at Run Time, I click on the first item in the list box. I get the following error message:

                Error opening file.
                There is no application associated with the given file name extension.
                0

                This implies that it is finding the first PDF file in the list, but that the associative feature of Windows is not functioning.

                When I click on the second and subsequent items in the list I recieve the error message:

                Error opening file.
                File not found.
                1

                The syntax I am using under List Items is:

                ItemName::%SrcDrv%\Distribution\NameOfFile.pdf

                As a general comment, I would have wished for a far more intituitive way of working with list boxes. At Design Time I would like to select an item in the list box and then click an Action tab for that item only. After setting the action, I would then move on to the next item until the list is finished. Currently it is not at all intuitive.
                Andrew

                Comment


                • #9
                  Re: List Box

                  I agree AMS4 has some very nice features,I think it forgot that many of us like me are not script writters the features need to be much more intuitive, I have been trying to get a list box to work and have been frustrated with all the scripting needed..

                  Comment


                  • #10
                    Re: List Box

                    Hi,

                    In your File.Open action try using:

                    File.Open (Open, "%ItemData%")

                    instead. Or try using a Dialog.ShowMessage action to display the contents of your variables.

                    mark.
                    MSI Factory The Next Generation Intelligent Setup Builder

                    Comment


                    • #11
                      Re: List Box

                      Mark,
                      Thanks for that. After a bit of tweaking of the paths it now works. Where I had %SrcDrv%\Distribution\Filename.pdf it was giving me an error message saying that it could not find ...\Distribution\Distribution\Filename.pdf. I removed "Distribution" from the string and it works.

                      I need to reiterate that the list box functionality should be far more intitutive and "gui-fied". I use javascript in Acrobat for form field handling and open document functions, so I am comfortable in a pure scripting environment. However this half-way-house situation is awkward to work with. In AMS3 you could build up a script without realising that you were doing it. If you can you should certainly have a point and click solution for the list boxes. For more advanced applications you might offer some AMS-specific javascript objects where more customised functionality is required.

                      Comment


                      • #12
                        Re: List Box

                        Excellent idea. Giving the option to embed javascript type functions into AMS4 would be fantastic!

                        Comment


                        • #13
                          Re: List Box

                          Hi,

                          Thanks for the input on the List Boxes; we definitely appreciate all comments that we receive.

                          The nice thing about the Lost Boxes is that they are very flexible, and allow you to create some really neat menus. Admittedly they do have a learning curve.

                          Hopefully you guys will continue to test and use the List Boxes, and keep giving us feed back about them.


                          mark.
                          MSI Factory The Next Generation Intelligent Setup Builder

                          Comment


                          • #14
                            Re: List Box

                            I think there might be a little to much flexibility, a point and click for my use would be great with an option for those who need more.

                            Comment


                            • #15
                              Re: List Box

                              Hi fredkauf,

                              What sort of options do you (or anyone else for that matter) think would make the List Box easier to use? Please be specific about what changes you would like to see and what you might use the List Box for.

                              mark.
                              MSI Factory The Next Generation Intelligent Setup Builder

                              Comment

                              Working...
                              X