Sign in to follow this  
Followers 0
anixon

htm Documents

21 posts in this topic

How do you launch an htm document that is associated with say Safari using the users default browser which might be iExplore.

I have tried the following code which does not work. What am I missing?

run(@scriptdir & "\Help\test.htm")

Help is always appreciated Ant.. :graduated:

Share this post


Link to post
Share on other sites



Try ShellExecute(@ScriptDir & "\Help\test.htm")

Thanks for that it works but gives rise to another question and that is how do you open the document on subsequent occasions without the 'Blocked content message? Ant..

Share this post


Link to post
Share on other sites

I'll go for hta file instead changing IE settings.

The document is created in Word and saved as a web page what program would you use that saves in hta format? Ant..

Share this post


Link to post
Share on other sites

there is no need for that! read here about hta.

try to change the extension of test.htm in .hta and run it.

Share this post


Link to post
Share on other sites

... and that means it worked or not? :graduated: I don't understand...

Thank you for the information your solution is working perfectly.

I created the document in Word with some text, tables and images saved it as a htm document. Then launched Safari opened the htm file and saved it as a HTA which has delivered exactly what was required.

It has been a valuable lesson which I can assure you has been very much appreciated thanks again for your help. Ant..

Share this post


Link to post
Share on other sites

No problem, mate!

Glad I could help! :graduated:

M.I.

'Mate' that is very Australian of you thanks

Given that HTA is a Microsoft function applicable to iExplore it does not work with Safari so the question is how do you determine what is the users default browser so that you can choose what file type to launch? Ant..

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

When you execute hta via ShellExecute, it will open with IE, even if it's not the default browser.

[edit] I know about "mate" from TV and from a very good scripter, enaiman.

Edited by taietel

Share this post


Link to post
Share on other sites

I guess there is an assumption that the User has iExplorer installed. Would it not be better to have two file types one that can be launched in iExplorer and the other in some other Browser like Safari? Ant..

Share this post


Link to post
Share on other sites

When you execute hta via ShellExecute, it will open with IE, even if it's not the default browser.

[edit] I know about "mate" from TV and from a very good scripter, enaiman.

Yes I know enaiman he lives not far from me but I would have to catch a boat to get there... Ant...

Share this post


Link to post
Share on other sites

If it has windows, there is no problem. Have you tried with Safary as default browser?

For precaution, you can use as you said two files. If IE is default, execute HTA; if not default or error execute htm file

Share this post


Link to post
Share on other sites

If it has windows, there is no problem. Have you tried with Safary as default browser?

For precaution, you can use as you said two files. If IE is default, execute HTA; if not default or error execute htm file

Yes works with Safari as a htm file but not after it has been converted to a HTA file. I guess I can read Registry to determine the default Browser and then if its iExplore launch the HTA file otherwise the htm Ant..

Share this post


Link to post
Share on other sites

You're right!

I did a search on See if it helps!

I'm going to take a nap, because my f***ing toothache is finally gone!!.

Cheers!

M.I.

Thanks for your help I think that this probably gets the information that I need

Const $BrowserID = RegRead("HKCU\Software\Clients\StartMenuInternet", "")
MsgBox(0,"",$BrowserID)

In my youth which was 60 odd years ago we used to use and this is purely from memory which on occasions I think has departed to an unknown destination anyway I think it was a product called 'Oil of Cloves' which you used to apply to the offending tooth. Anyway best wishes and thanks for you help again and I hope that everything goes well for you and yours during the holiday season and new year. Ant.,.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

No need to thank me. Was my pleasure! Thanks for the tip regarding the toothache.

Best wishes to you too!

Mihai Iancu

This is how the code looks

AutoItSetOption("WinTitleMatchMode", 4)
;//Call the routine
_BrowserProcessor(@ScriptDir & "\help\test")

;//Browser Processor
Func _BrowserProcessor($FileId)
 While 1
  ;//Determine Default Browser
  $BrowserID = RegRead("HKCU\Software\Clients\StartMenuInternet", "")
  ;//File based on iExplore as default browser
  If $BrowserID = $iExplore Then
   $FileId = $FileId & ".hta"
  Else
   $FileId = $FileId & ".htm"
  EndIf
  ;//Open the File
  If FileExists($FileId) Then
   ShellExecute($FileId)
   Sleep(500)
   ;//Compulsory Exit [5 Minutes]
   $sMsgTimerX = _DateAdd("n", 5, _NowCalcDate() & " " & @HOUR & ":" & @MIN & ":" & @SEC)
   While 1
    $handle = WinGetHandle($FileId, "")
    If $handle = "" Then ExitLoop (2)
    ;//Compulsory Exit
    If _NowCalc() >= $sMsgTimerX Then
     MsgBox(0, "", "Exiting UAC Help", 5)
     WinKill($FileId, "")
     ExitLoop (2)
    EndIf
    Sleep(100)
   WEnd
  EndIf
  ;//Default Text FileID
  If FileExists($FileId & ".txt") Then
   ;//Open Default file in Notepad
   _AutoNotepadExe($sESVista, $sLogDirHelp, $Width - ($nPWidth755 / 2), $nPHeightY, $nPWidth755, $nPHeight, 1000)
   ExitLoop
  EndIf
  MsgBox(64, "", "Default " & $FileId & " File NOT FOUND", $EndMenuTimer)
  ExitLoop
 WEnd
EndFunc   ;==>_BrowserProcessor

3rd Code Edit
Edited by anixon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0