{"id":118,"date":"2011-08-16T23:55:24","date_gmt":"2011-08-16T14:55:24","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=118"},"modified":"2021-10-25T22:53:03","modified_gmt":"2021-10-25T13:53:03","slug":"%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e9%81%b8%e6%8a%9e%e3%83%80%e3%82%a4%e3%82%a2%e3%83%ad%e3%82%b0","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=118","title":{"rendered":"\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0"},"content":{"rendered":"<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01-300x200.jpg\" alt=\"\" title=\"FileSelectDialog01\" width=\"300\" height=\"200\" class=\"alignnone size-medium wp-image-119\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01-300x200.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01-290x193.jpg 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01-150x100.jpg 150w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog01.jpg 720w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3059\u308bVBScript\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\nOS\u3084IE\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u306f\u5b9f\u884c\u3067\u304d\u306a\u3044\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\n'MsgBox GetFilePathMC()\r\n'MsgBox GetFilePathSF()\r\n'MsgBox GetFilePathUACD()\r\n'MsgBox GetFilePathIE()\r\nMsgBox GetFilePathIE2()\r\n\r\nPrivate Function GetFilePathMC()\r\n'Comdlg32.ocx\u3092\u5229\u7528\u3057\u305f\u30c0\u30a4\u30a2\u30ed\u30b0\r\n'\u203b \u8981\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u30c7\u30b6\u30a4\u30f3\u6642\u306e\u30e9\u30a4\u30bb\u30f3\u30b9(http:\/\/support.microsoft.com\/kb\/281848\/ja)\r\n  With CreateObject(&quot;MSComDlg.CommonDialog&quot;)\r\n    .Filter = &quot;All Files|*.*&quot;\r\n    .InitDir = &quot;.&quot;\r\n    .MaxFileSize = 256\r\n    .ShowOpen\r\n    GetFilePathMC = .FileName\r\n  End With\r\nEnd Function\r\n\r\nPrivate Function GetFilePathSF()\r\n'SAFRCFileDlg.FileOpen\u3092\u5229\u7528\u3057\u305f\u30c0\u30a4\u30a2\u30ed\u30b0\r\n'\u203b Windows XP\u9650\u5b9a\r\n  With CreateObject(&quot;SAFRCFileDlg.FileOpen&quot;)\r\n    If .OpenFileOpenDlg Then GetFilePathSF = .FileName\r\n  End With\r\nEnd Function\r\n\r\nPrivate Function GetFilePathUACD()\r\n'UserAccounts.CommonDialog\u3092\u5229\u7528\u3057\u305f\u30c0\u30a4\u30a2\u30ed\u30b0\r\n'\u203b Windows XP\u9650\u5b9a\r\n  With CreateObject(&quot;UserAccounts.CommonDialog&quot;)\r\n    .Filter = &quot;All Files|*.*&quot;\r\n    .InitialDir = &quot;.&quot;\r\n    If .ShowOpen Then GetFilePathUACD = .FileName\r\n  End With\r\nEnd Function\r\n\r\nPrivate Function GetFilePathIE()\r\n'IE\u3092\u5229\u7528\u3057\u305f\u30c0\u30a4\u30a2\u30ed\u30b0\r\n'\u203b Internet Explorer 8\u4ee5\u964d\u3067\u306ffakepath\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\r\n  Dim iptObj\r\n  Dim ret\r\n  \r\n  With CreateObject(&quot;InternetExplorer.Application&quot;)\r\n    .Visible = False\r\n    .Navigate &quot;about:blank&quot;\r\n    \r\n    '\u8868\u793a\u5f85\u3061\r\n    While .Busy Or .readyState &lt;&gt; 4\r\n      WScript.Sleep 100\r\n    Wend\r\n    \r\n    Set iptObj = .document.createElement(&quot;input&quot;)\r\n    iptObj.setAttribute &quot;type&quot;, &quot;file&quot;\r\n    .document.body.appendChild iptObj\r\n    iptObj.Click\r\n    ret = iptObj.Value\r\n    Set iptObj = Nothing\r\n    .Quit\r\n  End With\r\n  GetFilePathIE = ret\r\nEnd Function\r\n\r\nPrivate Function GetFilePathIE2()\r\n'IE\u3092\u5229\u7528\u3057\u305f\u30c0\u30a4\u30a2\u30ed\u30b0(2)\r\n'\u203b Internet Explorer 8\u4ee5\u964d\u306b\u3082\u5bfe\u5fdc\r\n  Dim iptObj\r\n  Dim ret\r\n  \r\n  With CreateObject(&quot;InternetExplorer.Application&quot;)\r\n    .Visible = False\r\n    .FullScreen = True\r\n    .Navigate &quot;about:blank&quot;\r\n    \r\n    '\u8868\u793a\u5f85\u3061\r\n    While .Busy Or .readyState &lt;&gt; 4\r\n      WScript.Sleep 100\r\n    Wend\r\n    \r\n    Set iptObj = .document.createElement(&quot;input&quot;)\r\n    iptObj.setAttribute &quot;type&quot;, &quot;file&quot;\r\n    .document.body.appendChild iptObj\r\n    iptObj.Click\r\n    If Trim(Len(iptObj.Value)) &gt; 0 Then\r\n      iptObj.Focus\r\n      .ExecWB 17, 0 'OLECMDID_SELECTALL\r\n      .ExecWB 12, 0 'OLECMDID_COPY\r\n      ret = CreateObject(&quot;htmlfile&quot;).parentWindow.clipboardData.GetData(&quot;text&quot;)\r\n    End If\r\n    Set iptObj = Nothing\r\n    .Quit\r\n  End With\r\n  GetFilePathIE2 = ret\r\nEnd Function<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog02.jpg\" alt=\"\" title=\"FileSelectDialog02\" width=\"220\" height=\"168\" class=\"alignnone size-full wp-image-120\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog02.jpg 220w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/FileSelectDialog02-150x114.jpg 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u8868\u793a\u3059\u308bVBScript\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002 OS\u3084IE\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u306f\u5b9f\u884c\u3067\u304d\u306a\u3044\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u3002","protected":false},"author":1,"featured_media":7132,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[139],"class_list":["post-118","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vbs","tag-vbs"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-VBScript.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1U","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":6,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":14221,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions\/14221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7132"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}