how to open an html file to a section in the file?

how to open an html file to a section in the file?

Julio_Soto
Advisor Advisor
606 Views
6 Replies
Message 1 of 7

how to open an html file to a section in the file?

Julio_Soto
Advisor
Advisor

so i feel I almost have this. it's a simple line like this

 

(startapp "explorer" "file:///C:CAD/300-drawings.html#layouts-criteria")

this opens the HTML page just fine, but it doesn't go to the section "#layouts-critria"

 

It does go to the section if I explicitly use chrome

(startapp "C:/Program Files/Google/Chrome/Application/chrome.exe"...etc)

but I don't want to force Chrome, I want to use the default browser.

 

how can I use the default browser for this?

0 Likes
Accepted solutions (1)
607 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor

works for me when I enter the following code:

(startapp "explorer" "https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-the-same-tag-value-extension-for-batch-attribute/m-p/13342330/highlight/true#M479320")

My default Opera browser opens to that section of the thread:

paullimapa_0-1740852841223.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 7

cadffm
Consultant
Consultant

Hi,

 

if registry path not changed in newer Win versions:

 

(defun GetBrowser (/ str)
  (substr (setq str (vl-registry-read
      "HKEY_CLASSES_ROOT\\htmlfile\\shell\\open\\command"
    )
  )
  2
  (1- (vl-string-search "\" " str))
  )
)

 

 

Sebastian

0 Likes
Message 4 of 7

Julio_Soto
Advisor
Advisor

@paullimapa 

 

if I copy/paste what you showed, it works. but if it's on a shared drive or my local drive , it doesn't 

0 Likes
Message 5 of 7

paullimapa
Mentor
Mentor
Accepted solution

For local file which I have this thread saved under:

"C:\Autodesk\how-to-open-an-html-file-to-a-section-in-the-file.html"

I can use this lisp code to successfully open the default web browser to access section #M479451:

(command "._browser" "file:///C:/Autodesk/how-to-open-an-html-file-to-a-section-in-the-file.html#M479451")

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 7

Julio_Soto
Advisor
Advisor

ahh using "browser" was the key. I thought I tried that and it didn't work, but it's working now. maybe I typed it wrong. 

 

thank you!

0 Likes
Message 7 of 7

paullimapa
Mentor
Mentor

you are welcome...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes