VCOM:VectorWorks:ISDK::OpenURL: Difference between revisions
No edit summary |
m (1 revision) |
(No difference)
|
Latest revision as of 15:05, 12 August 2013
.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference
Description
namespace VectorWorks
Member of VCOM:VectorWorks:ISDK
Opens a web page or file using the default browser or appropriate application (e.g. Adobe Acrobat). Returns a boolean indicating the success of the operation.
The URL (Uniform Resource Locator) is a pointer to a resource on the World Wide Web. It specifies both the protocol and location of the document to open.
- For files on the local computer, the URL should begin with
file://
protocol specifier. - For web pages, the URL should begin with
http://
. The URL should use forward slashes / to separate parts of the path.
There are some platform differences to be aware of. Windows will accept either \ or / as the path separators. MacOS X requires that file://
URLs begin with /Volumes/
before the drive name. Also, currently the MacOS X implementation of OpenURL does not accept spaces in the URL. Spaces should be replaced with the escape code Note #20, see after the code block.
before calling this function.
Note: The function VS:GetFolderPath returns a string with separators specific for the platform it is running on (/ on Mac and \ on Windows). If your script calls this function to assemble a local file://
URL then you will have to replace the : separators with / characters.
virtual Boolean VCOM_CALLTYPE OpenURL(
const TXString& url) = 0;
Parameters
url const TXString& The URL (Uniform Resource Locator) for the web page or file to open.
Return Value
Returns a boolean indicating the success of the operation.
Remarks
1.) Use forward slash / to separate directories. (Windows accepts \ or / as separators. )
2.) Use file:///
to begin the URL if it is a file on your local machine.
theURL := 'file:///C:/Documents and Settings/Jeff/My Documents/Test.htm';
3.) Use http://
to begin the URL if the page is hosted by a web server.
theURL := 'http://www.vectordepot.com';
4.) Tests show that this can also be used with mailto:
. Could be a nice way to get feedback from your users...
If you are on MacOS X:
5.) For a file on the boot drive, the path should not contain the name of the drive.
theURL := 'file:///Documents/Test.html';
6.) For file on other non-boot drive or partition, the path should begin with /Volumes/ followed by the name of the partition.
theURL := 'file:///Volumes/Xtra2/SomeTest.html';
7.) Spaces are not allowed in the url. Replace them with %20 characters. This is a bug that we should be able to fix in future version. (MacOS 9 and Windows seem to accept spaces.)
theURL := 'file:///Documents/This%20Is%20A%20Test.html';
Version
Availability: from Vectorworks 2009