Announcement

Collapse
No announcement yet.

Listbox and default viewer

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

  • Listbox and default viewer

    Hi all, I' need a little help regarding my project.
    On a page I've an input box, a winbutton and finally a listbox.

    Here the codes:

    WinButton
    Code:
    ListBox.DeleteItem ("Listbox1", -1); -- clear the content of the search result list
    ListBox.SetUpdate ("Listbox1", false);
    
    sFile_name = Input.GetText ("Input1"); -- gets the name of the file (use * to find all files with the defined extension)
    
    StatusDlg.Show(); -- shows the status of the search function
    
    tFind_file = File.Find ("C:\\Archive",  "*pdf", true, false);
    
    
    if tFind_file then -- if at least one file is found...
    	for k, found_file in pairs(tFind_file) do -- enumerates the files found
    		tSplit_found_path = String.SplitPath (found_file);
    		if sFile_name == "*" then
    			ListBox.AddItem ("Listbox1", tSplit_found_path.Filename..tSplit_found_path.Extension, found_file); -- add each file to the list
    		else
    			if String.Find (tSplit_found_path.Filename, sFile_name, 1, false) ~= -1 then
    				ListBox.AddItem ("Listbox1", tSplit_found_path.Filename..tSplit_found_path.Extension, found_file); -- add each file to the list
    			end
    		end	
    	end
    	
    end
    StatusDlg.Hide(); -- hide the status dialog
    if ListBox.GetCount ("Listbox1") == 0 then
    	Dialog.Message ("Attention", "No files here.", MB_OK, MB_ICONEXCLAMATION);
    end	
    
    ListBox.SetUpdate ("Listbox1", true);
    
    Page.SetFocus ("Input1");

    ListBox
    On Double-Click
    Code:
    if ListBox.GetSelected (this) ~= nil then
    	Shell.Execute (ListBox.GetItemData (this, List_Select[1]), "open");
    Window.Minimize(Application.GetWndHandle());
    end
    On Select
    Code:
    List_Select = ListBox.GetSelected (this);
    if ListBox.GetSelected (this) ~= nil then
    end

    So, by using this, all my PDF are obviously opened with the installed viewer, in my case Adobe Reader as usual.

    Now I need to open my PDF with a portable version of Sumatra PDF Reader, included in the Docs folder (SumatraPDF.exe)

    Please help me, it's a simple project but very useful for my needs.

    Thanks a lot in advance.

  • #2
    I my dear friend, a similar code will be useful for me too.
    I searched in my .apz archive and on the forum without success.
    I really hope in some help from a master user here.
    On August it's very difficult someone help us in little time.
    Anyway as you I hope in some suggestion.
    Thank you forum.

    Comment


    • #3
      hi

      you can look at this example to do that :


      PHP Code:
      --
      File.Run("AutoPlay\\Docs\\SumatraPDF.exe""AutoPlay\\Docs\\ChannelList2.pdf"""SW_SHOWNORMALtrue); 

      Comment


      • #4
        Your suggestion is good for a simple file launch.
        I need something to use with the listbox.
        If you have a solution ...thank you anyway

        Comment


        • #5
          Originally posted by AndrewX View Post
          Your suggestion is good for a simple file launch.
          I need something to use with the listbox.
          If you have a solution ...thank you anyway
          Oh You must employ what you learn right main employers
          In any case this is an example as you want
          " here you are "

          Listbox and default viewer by titogyme.apz


          this example for all Visitor or Newest member on My Dropbox Server


          Comment


          • #6
            :yesExcellent work Thanks

            Comment


            • #7
              Dear man, thank you for the suggestion and for the project.
              You solved my little problem with documents.

              Comment


              • #8
                You are welcome my dear at any time and with any questions

                Comment


                • #9
                  Hi titogyme, is there a way to open a pdf directly from its location, without copy it into Docs folder?
                  I use an editor to open PDF so if I edit the document, I edit the copy in Docs folder and not the original file.
                  Thank you for your time.

                  Comment


                  • #10
                    learn AMS's basic functions you don't have to use the AMS folder this was a example, they was really nice to make the demo them for you, but everything you asked would be clear if you sat down with a cup of coffee and read the manual a few times, if you want to select the path at run time maybe look at Dialog Browse File function.

                    titogyme, nice you made the demo for them but remember to run the clear option, you have included Memory plugin what clear is not needed in this example lol

                    @ Error: Plugin "AMSWMemory\AMSWMemory.lmd" is not licensed for re-distribution

                    Plugins or Sources MokoX
                    BunnyHop Here

                    Comment


                    • #11
                      [QUOTE=kingzooly;193320]

                      titogyme, nice you made the demo for them but remember to run the clear option, you have included Memory plugin what clear is not needed in this example lol

                      @ Error: Plugin "AMSWMemory\AMSWMemory.lmd" is not licensed for re-distribution


                      Sorry was inadvertently omitted

                      Comment


                      • #12
                        Originally posted by kingzooly View Post

                        titogyme, nice you made the demo for them but remember to run the clear option, you have included Memory plugin what clear is not needed in this example lol

                        @ Error: Plugin "AMSWMemory\AMSWMemory.lmd" is not licensed for re-distribution
                        Sorry was inadvertently omitted

                        Comment


                        • #13
                          Originally posted by Drag View Post
                          Hi titogyme, is there a way to open a pdf directly from its location, without copy it into Docs folder?
                          I use an editor to open PDF so if I edit the document, I edit the copy in Docs folder and not the original file.
                          Thank you for your time.
                          Yes you can do that with out Coping Files to Docs Folder
                          But you will face a problem to pass the parameter "parameter path and file name to be opened"

                          For example Look at this path :

                          C:\Users\titogym\Desktop\ww\docu\Word2007RTFSpec9.pdf


                          you will see an folder named "ww" Without any break it's mean "ww" ~= "w w"

                          So there will be a bug in the parameter if the path contains a separator between the letters of the names of folders and any folder with This description


                          Note : " C:\Users\titogym\Desktop\ww\docu\Word2007RTFSpec9. pdf " is an argument or an parameter Opend by SumatraPDF.exe Program .

                          the args It must not contain spaces between characters .


                          Do you understand what I mean ?

                          Comment


                          • #14
                            No problem, my files are in Autoplay\\Docs\\Archive and all pdf are named without spaces.
                            So, if you've time you can edit or adding an option like this.
                            Thanks obviously.

                            Comment


                            • #15
                              Originally posted by Drag View Post
                              No problem, my files are in Autoplay\\Docs\\Archive and all pdf are named without spaces.
                              So, if you've time you can edit or adding an option like this.
                              Thanks obviously.

                              ok here you are and look at Script Page " On Show" and Script ListBox " On Select " :


                              Listbox and default viewer 2 by titogyme.apz

                              Comment

                              Working...
                              X