Issue 124049 - SystemShellExecute doesn't open browser with local HTML file + target
Summary: SystemShellExecute doesn't open browser with local HTML file + target
Status: UNCONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 4.0.1
Hardware: PC Windows 7
: P3 Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needhelp
Depends on:
Blocks:
 
Reported: 2014-01-18 14:29 UTC by rvboni
Modified: 2014-02-02 13:39 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description rvboni 2014-01-18 14:29:51 UTC
SystemShellExecute doesn't open browser with local HTML file + target.

Macro example  (with HTML help file in SDK):

Sub OpenHtml() 
  Dim oShell As Object
  Dim Fichier As String, uFile As String
  
	Fichier = "file:///C:/Program%20Files%20%28x86%29/OpenOffice%204/sdk/docs/common/ref/com/sun/star/lang/XServiceInfo.html"
	uFile = ConvertToUrl(Fichier)
	oShell = createUnoService("com.sun.star.system.SystemShellExecute") 
	oShell.execute(uFile, "", 0) ' works
	uFile = uFile & "#getImplementationName"
	oShell.execute(uFile, "", 0) ' doesn't work, see error message below
	uFile = ConvertToUrl(Fichier & "#getImplementationName")
	oShell.execute(uFile, "", 0) ' doesn't work, see error message below
 
End Sub

The error message is: "Windows ne trouve pas 'C\Program Files (x86)\OpenOffice 4\sdk\docs\(...) ".

"Windows ne trouve pas" = "Windows doesn't find"
Comment 1 Edwin Sharp 2014-01-19 13:16:08 UTC
Please specify steps to reproduce bug.
Comment 2 rvboni 2014-01-19 13:55:43 UTC
(In reply to Edwin Sharp from comment #1)
> Please specify steps to reproduce bug.
1. First step is to copy or install any HMTL file (with targets inside) in the local system files. In my case it's Windows7 system file.
In the example I've taken the help system of the AOO SDK.
2. Execute the macro "OpenHtml()" (with the appropriate way to the HTML file), from Calc or Writer.
Comment 3 Edwin Sharp 2014-01-19 14:02:16 UTC
Thank you rvboni.
Comment 4 bmarcelly 2014-01-21 11:32:53 UTC
Remark:
In MS-Windows, setting a shortcut to an address#target displays the page but ignores the target. So it seems a limitation of the OS.


Workaround :

SystemShellExecute can open a target in an HTML file if the browser is directly called, with the file#target as argument.

Dim BrowserAddr As String
' BrowserAddr is the address of the browser in system specific syntax
' uFile is the URL address as in Description

oShell.execute(BrowserAddr, uFile, 0)
Comment 5 rvboni 2014-01-21 17:19:56 UTC
(In reply to bmarcelly from comment #4)
> Remark:
> In MS-Windows, setting a shortcut to an address#target displays the page but
> ignores the target. So it seems a limitation of the OS.
I believe it depends from which component the address#target is called.
From Basic or Writer (see also bug 18325) it produces an error.
From Calc it displays the page but ignores the target (if my memory doesn't fail).
So, I'm not sure that it depends only of the OS ?
> 
> 
> Workaround :
> 
> SystemShellExecute can open a target in an HTML file if the browser is
> directly called, with the file#target as argument.
> 
> Dim BrowserAddr As String
> ' BrowserAddr is the address of the browser in system specific syntax
> ' uFile is the URL address as in Description
> 
> oShell.execute(BrowserAddr, uFile, 0)
It's the way used in XRAY (and how I workaround), but it needs to choose a priori a browser.
Comment 6 rvboni 2014-02-02 13:39:01 UTC
(Add-on to rvboni from comment #5)

The best workaround I've found is:

1. search the path of the default browser in Windows'registry, see for example:
https://forum.openoffice.org/fr/forum/viewtopic.php?f=8&t=42005#p229844

2. use Shell (instead of SystemShellExecute):
    URL = "file:///C:/SomeHTMLFilePath.html" & "#someTarget"
    Shell(DefaultBrowserPath,2,URL)