ユーザが URL を入力することのできるダイアログ ボックスが起動されます。
サポートされているプラットフォーム: Windows のみ
VBA:
RetVal = object.LaunchBrowserDialog(SelectedURL, DialogTitle, OpenButtonCaption, StartPageURL, RegistryRootKey, OpenButtonAlwaysEnabled)
タイプ: Utility
このメソッドが適用されるオブジェクト。
アクセス: 出力のみ
タイプ: 文字列
選択した URL。
アクセス: 入力のみ
タイプ: 文字列
ダイアログ ボックスに表示されるタイトル。
アクセス: 入力のみ
タイプ: 文字列
[OK]/[開く]ボタンのキャプション。
アクセス: 入力のみ
タイプ: 文字列
最初に表示される URL。
アクセス: 入力のみ
タイプ: 文字列
ダイアログ ボックスの不変情報を保存するためのプロダクト ルート キー。ダイアログ ボックスのサイズ、位置に関する情報、およびその他の基本情報を現在のセッションから次のセッションまで保存することができる場所がキーにより指定されます。この機能を無視するには空の文字列を入力します。
アクセス: 入力のみ
タイプ: ブール型
タイプ: ブール型
最後のパラメータ、OpenButtonAlwaysEnabled は、ダウンロード可能なファイル以外にも、HTML リンクの選択を可能にするかどうかを決定します。
VBA:
Sub Example_LaunchBrowserDialog()
' This example will prompt the user for a URL to download and will verify that
' a proper URL was entered. After downloading, the example will attempt to load
' the downloaded URL as a drawing.
'
' * Note: Remember to delete the downloaded file from your disk drive when finished.
Dim Utility As AcadUtility
Dim URL As String, DestFile As String, FileURL As String
Set Utility = ThisDrawing.Utility ' Connect to Utility object
GETURL:
' Prompt user for a URL to download. This should be a URL to an AutoCAD drawing file.
URL = InputBox("Enter the complete URL of the file you wish to download. " & _
"Enter BROWSER to select the URL from a web browser", _
"Enter URL To Download", URL)
URL = Trim(URL) ' Get rid of blank spaces
If URL = "" Then Exit Sub ' Did user cancel
' Does the user want to select from a browser?
If StrComp(URL, "BROWSER", vbTextCompare) = 0 Then
Utility.LaunchBrowserDialog _
URL, "AutoCAD Browser", "Open", "https://www.autodesk.com", "ACADBROWSER", True
GoTo GETURL ' Return to display chosen URL and allow modifications
End If
' Determine if user entered a valid URL; if not, prompt again
If Not (Utility.IsURL(URL)) Then
MsgBox "The URL you entered is not valid. Make sure the syntax is a valid URL."
GoTo GETURL
End If
' Download URL
Utility.GetRemoteFile URL, DestFile, True
' Display downloaded file information
MsgBox URL & " was downloaded to: " & DestFile & vbCrLf & vbCrLf & _
"Press any key to attempt to load the new file as a drawing."
' Attempt to load file as drawing; if an error occurs, this was probably not a drawing
' file, but rather the text from a web page.
' Try loading the downloaded file into a text editor to view the contents.
On Error Resume Next
ThisDrawing.Application.Documents.Open DestFile
If Err.Number <> 0 Then
MsgBox "Error loading downloaded file as a drawing: " & Err.Description & vbCrLf & vbCrLf & _
"This is probably not a valid drawing file!"
End If
On Error GoTo 0
' Use IsRemoteFile to determine if this file was downloaded from a URL.
' If it was, display the URL it was downloaded from
'
' * Note: Although the results IsRemoteFile will return are already known because
' the file was just downloaded, it is important to know how this
' method can be used.
If Utility.IsRemoteFile(DestFile, FileURL) Then
MsgBox "The file: " & DestFile & " is a downloaded file and was downloaded from: " & FileURL
Else
MsgBox "The file: " & DestFile & " is not a downloaded file."
End If
End Sub
Visual LISP:
Not available