creating an url in dcl

Discussion in 'AutoCAD' started by Marcel Janmaat, Dec 3, 2004.

  1. Hello there;

    I have a text in my dcl but want it to be a clickable url. Is this posible?

    MJ
     
    Marcel Janmaat, Dec 3, 2004
    #1
  2. Marcel Janmaat

    ECCAD Guest

    Marcel,
    Here are the fragments:
    Place Button in .dcl, with url as 'Label'.
    : button {
    label = "http://www.bobscadshop.com";
    key = "url";
    }
    In Lisp:
    At top of Dialog control section..
    (setq gothere nil)

    (action_tile "url" "(setq gothere 1)(done_dialog 4)")
    .....
    (unload_dialog dcl_id)

    (if gothere
    (command "_browser" "http://www.bobscadshop.com")
    ); if

    Cheers: :))
    Bob
     
    ECCAD, Dec 3, 2004
    #2
  3. Thanx Bob,

    I guess this means i'ts not posible to place it in a text item then.

    M
     
    Marcel Janmaat, Dec 4, 2004
    #3
  4. Unfortunatly I just noticed this cannot be done leaving the dialoge opened.

    You're certain there are no other ways?

    It's not a big problem, but would be nice dough.

    M
     
    Marcel Janmaat, Dec 4, 2004
    #4
  5. Marcel Janmaat

    John Uhden Guest

    Take a look at the ActiveX LaunchBrowserDialog method.
     
    John Uhden, Dec 4, 2004
    #5
  6. Marcel Janmaat

    ECCAD Guest

    Leaving the dialog 'open' is a problem..you (really) want to
    close that, then go browsing..the button method works - right ?. For double-click on the text, you could try a text_box,
    (and) check that tile, exit dialog, and browser..would work
    in the same fashion.

    Bob
     
    ECCAD, Dec 4, 2004
    #6
  7. Marcel Janmaat

    ECCAD Guest

    This seems to work with a 'button' or 'edit_box' in the .dcl

    --------------------------
    (if (not (new_dialog "test_url" dcl_id)) (exit))
    (set_tile "url2" "http://www.bobscadshop.com")

    ;; Fire-up the Dialog
    (setq url nil gothere nil)
    (setq what_next 7)
    (while (/= 4 what_next)
    (action_tile "url" "(setq gothere 1)(done_dialog 8)"); button
    (action_tile "url2" "(setq url $value)(done_dialog 8)"); edit_box
    (action_tile "accept" "(done_dialog 4)")
    (action_tile "cancel" "(done_dialog 4)")
    (setq what_next (start_dialog))
    (unload_dialog dcl_id)
    (cond
    ( (= what_next 8)
    (if gothere
    (progn
    (command "_browser" "http://www.bobscadshop.com")
    ); progn
    ); if
    (if url
    (progn
    (command "_browser" url)
    ); progn
    ); if
    (setq dcl_id (load_dialog chk_file))
    (if (not (new_dialog "test_url" dcl_id)) (exit))
    (set_tile "url2" "http://www.bobscadshop.com")
    ); what_next=8
    ); cond
    ;;
    ); end while what_next
    --------------------
    The trick here is to 'fire-up' the dialog again...
    as in:
    (setq dcl_id (load_dialog chk_file))
    (if (not (new_dialog "test_url" dcl_id)) (exit))
    (set_tile "url2" "http://www.bobscadshop.com")

    Bob
     
    ECCAD, Dec 4, 2004
    #7
  8. There's other ways, but I don't think you're after what the
    LaunchBrowserDialog method does, since you already know
    the URL and only want to open it in Explorer.

    In that case, you can use this:

    (defun navigate (url / shell)
    (vl-load-com)
    (setq shell
    (vla-get-interfaceobject
    (vlax-get-acad-object)
    "Shell.Application"
    )
    )
    (vlax-invoke-method shell 'Open url)
    (vlax-release-object shell)
    )

    As far as not using a button to do this in DCL, that's
    not possible, but you might be able to fake it using a
    slide image (big kludge).
     
    Tony Tanzillo, Dec 6, 2004
    #8
  9. oops. Did it again!

    In that function, change this

    'vla-get-interfaceobject'

    to this

    'vla-getinterfaceobject'
     
    Tony Tanzillo, Dec 6, 2004
    #9
  10. Earlier I solved it like this;

    (action_tile "url" "(c:mywebsite)")
    (defun c:mywebsite ()
    (startapp "C:\\Program Files\\Internet Explorer\\iexplore"
    "http://www.mywebsite.nl")
    )

    But I Guess yours works also when IE is installed in a different location or
    when I use a different browser?

    I'm using yours now.

    Thanx!
    M
     
    Marcel Janmaat, Dec 7, 2004
    #10
  11. Um, yeah, what you have posted would definitely cause a
    problem for some people.

    Why not just use

    (command "._browser" "http://MyURL")

    Matt

     
    Matt Stachoni, Dec 31, 2004
    #11
  12. Can't do that while a DCL dialog is active.
     
    Tony Tanzillo, Jan 1, 2005
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.