Jump to content

htm Documents


anixon
 Share

Recommended Posts

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:

Link to comment
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..

Link to comment
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..

Link to comment
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.

Edited by taietel
Link to comment
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...
Link to comment
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

Link to comment
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..

Link to comment
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.,.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...