Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 35
  1. #1
    Join Date
    Feb 2005
    Location
    Oklahoma
    Posts
    12

    How to browse for and open file in ams5?

    Hi:
    I'm having a little trouble getting ams5 to browse for a local .htm file and then opening it in web browser object. In ams4 i used a dll, but i don't know how to use the dll in ams5. Can I browse for local htm file and open it without using dll in ams5? Any code examples would be much appreciated. Thank you,
    Hammerstein

  2. #2
    Josué Alba Guest
    well yoy can use the File.Open action. it should be something like this.

    Code:
    File.Open("AutoPlay\\Docs\\index.htm", "", SW_MAXIMIZE);

  3. #3
    Join Date
    Feb 2005
    Location
    Oklahoma
    Posts
    12

    Need to browse for file

    I need to be able to browse for file, i.e. select file at time of opening, not a already determined page...

    Thankx

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Here is a link to the online web help for I.R./AMS 5 that may be of help:

    http://www.indigorose.com/webhelp/am...FileBrowse.htm

    and...

    http://www.indigorose.com/webhelp/am...e_Examples.htm
    Intrigued

  5. #5
    Join Date
    Feb 2005
    Location
    Oklahoma
    Posts
    12

    Examples full of errors

    Can someone show me a working example, wherefrom I can see exactly how it is done to get me started. For example, I want to browse for a local html file and then open it in web browser object after choosing the file. Unfortunately examples given online with ams help result in string errors etc. I'm still new to this, and just need a working example wherefrom I can see exactly how it is done. Thanx much.

  6. #6
    Join Date
    May 2003
    Location
    Pendleton, Oregon
    Posts
    1,038
    Here is a little example for you.
    Attached Files
    Add-ons for AMS. Toolbar Buttons Galore, System Animations, the Window Construction Kit, and more.
    Visit Acme-Tek

  7. #7
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Here's some code to try

    Code:
    --Browse for a file.  This action returns a table.  This particular call, limits the slection to
    --one, so the table will only have 1 element.  If that first element is = "CANCEL" then the user
    --didn't choose a file
    
    --Browse for file
    tblFile = Dialog.FileBrowse(true, "Select the HTM or HTML file to open", "", "HTM Files (*.htm)|*.htm|HTML Files (*.html)|*.html|", "", "htm", false, true)
    
    --Test to see if the user canceled, if so, don't process
    if tblFile[1] ~= "CANCEL" then
    	--check the filename to see if it is a HTM or HTML file
    	if String.Right(String.Upper(tblFile[1]),3) ~= "HTM" then
    		if 	String.Right(String.Upper(tblFile[1]),4) ~= "HTML" then
    			--Show dialog indicating that they didn't choose a HTML or HTM file
    			nResult = Dialog.Message("Invalid File Type", "Please select only HTM or HTML files.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
    			--exit this script
    			return
    		end
    	end
    	--load the file into the web object
    	Web.LoadURL("Web1", tblFile[1])
    
    end
    JimS is faster'n me

  8. #8
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by Worm
    Here's some code to try

    Code:
    --Browse for a file.  This action returns a table.  This particular call, limits the slection to
    --one, so the table will only have 1 element.  If that first element is = "CANCEL" then the user
    --didn't choose a file
    
    --Browse for file
    tblFile = Dialog.FileBrowse(true, "Select the HTM or HTML file to open", "", "HTM Files (*.htm)|*.htm|HTML Files (*.html)|*.html|", "", "htm", false, true)
    
    --Test to see if the user canceled, if so, don't process
    if tblFile[1] ~= "CANCEL" then
    	--check the filename to see if it is a HTM or HTML file
    	if String.Right(String.Upper(tblFile[1]),3) ~= "HTM" then
    		if 	String.Right(String.Upper(tblFile[1]),4) ~= "HTML" then
    			--Show dialog indicating that they didn't choose a HTML or HTM file
    			nResult = Dialog.Message("Invalid File Type", "Please select only HTM or HTML files.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
    			--exit this script
    			return
    		end
    	end
    	--load the file into the web object
    	Web.LoadURL("Web1", tblFile[1])
    
    end
    JimS is faster'n me
    It's the quality and not the speed Worm!

    *I have learned this the hard way, ouchy!
    Intrigued

  9. #9
    Join Date
    May 2003
    Location
    Pendleton, Oregon
    Posts
    1,038
    I just realized that you want to be able to search for both .html & .htm files

    To do that, you could change this line:

    result = Dialog.FileBrowse(true, "Locate HTML File", _DesktopFolder, "HTML Files (*.html)|*.html|", "", "html", false, true);

    to this:

    result = Dialog.FileBrowse(true, "Locate HTML File", _DesktopFolder, "HTML Files (*.htm or *.html)|*.htm*|", "", "htm*", false, true);
    Add-ons for AMS. Toolbar Buttons Galore, System Animations, the Window Construction Kit, and more.
    Visit Acme-Tek

  10. #10
    Join Date
    May 2003
    Location
    Pendleton, Oregon
    Posts
    1,038
    Quote Originally Posted by Intrigued
    It's the quality and not the speed Worm!

    *I have learned this the hard way, ouchy!

    That’s a fact. He and I were just discussing something like that the other day.

    Worm’s code is commented and contains error correction , my example is just a simple 2 lines, no comments or error trappings.

    I’m sure that Worm would have posted before me if he would have taken the same shortcuts I did.

    I’m just trying to help field the easy questions so Worm has more time to answer the tough ones.
    Add-ons for AMS. Toolbar Buttons Galore, System Animations, the Window Construction Kit, and more.
    Visit Acme-Tek

  11. #11
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    What I just learned about that code Worm posted (thanks!) is another way to look at code via way of his use of the return built-in to break out of the code!

    That's just plain cool!
    Intrigued

  12. #12
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    One tweak I believe I would change Worm... instead of two seperate entries in the dropdown dialog (to choose the .html and .htm files); I would use a single line and have (.htm, html) sort of setup.

    Minor detail to be sure, but it seems that is what a tipical dialog like that would do.
    Intrigued

  13. #13
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Yep, I would too, except I was racing JimS to answer and totally over-looked it

  14. #14
    Join Date
    May 2003
    Location
    Pendleton, Oregon
    Posts
    1,038
    Worm,
    You know that I’m not one to ever brag or rub it in, and I’d never toot my own horn about winning a race. So, this is strictly as a public service reminder for our friends keeping score at home

    JimS 1
    Worm 1,740

    Don’t give up or be too hard on yourself, I don’t want this loss to keep you up all night worrying. Keep on practicing and maybe you’ll have better luck next time.



    .
    Add-ons for AMS. Toolbar Buttons Galore, System Animations, the Window Construction Kit, and more.
    Visit Acme-Tek

  15. #15
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    I the words of Corey; "Hee!"

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts