{"id":13423,"date":"2020-12-24T12:00:32","date_gmt":"2020-12-24T03:00:32","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=13423"},"modified":"2020-12-24T16:09:55","modified_gmt":"2020-12-24T07:09:55","slug":"input-type-file%e3%81%ae%e3%80%8c%e3%82%a2%e3%83%83%e3%83%97%e3%83%ad%e3%83%bc%e3%83%89%e3%81%99%e3%82%8b%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ae%e9%81%b8%e6%8a%9e%e3%80%8d%e3%83%80%e3%82%a4","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=13423","title":{"rendered":"input type file\u306e\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p>\u4e45\u3057\u3076\u308a\u306eVBA\u30cd\u30bf\u3067\u3059\u3002<br \/>\n<i>\u300cInternet Explorer\u3092\u64cd\u4f5c\u3057\u3066 input type=&quot;file&quot; \u3067\u8868\u793a\u3055\u308c\u308b\u201c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0\u201d\u3092\u5236\u5fa1\u3067\u304d\u306a\u3044\u304b\uff1f\u300d<\/i>\u3068\u306e\u3054\u8cea\u554f\u3092\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>Q&#038;A\u30b5\u30a4\u30c8\u3067\u3082\u305f\u307e\u306b\u898b\u304b\u3051\u308b\u8cea\u554f\u3067\u3059\u3002<br \/>\n\u305d\u308c\u3060\u3051\u591a\u304f\u306e\u65b9\u304c\u8e93\u304b\u308c\u3066\u3044\u308b\u306e\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u65ad\u3063\u3066\u304a\u304d\u307e\u3059\u3068\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u500b\u4eba\u7684\u306b\u306f input type=&quot;file&quot; \u306e\u5236\u5fa1\u306f\u8003\u3048\u306a\u3044\u65b9\u304c\u826f\u3044<\/span>\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e0a\u306e\u89b3\u70b9\u304b\u3089IE8\u306e\u6642\u70b9\u3067\u3059\u3067\u306b\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3057(\u4e0b\u8a18\u53c2\u7167)\u3001\u3053\u3053\u3092\u7121\u7406\u3057\u3066\u81ea\u52d5\u5316\u3059\u308b\u3088\u308a\u306f\u3001\u30b5\u30a4\u30c8\u5074\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308bAPI\u7b49\u3001\u6b63\u898f\u306e\u65b9\u6cd5\u3092\u691c\u8a0e\u3057\u305f\u65b9\u304c\u826f\u3044\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>\u30e6\u30fc\u30b6\u30fc\u304c\u5165\u529b\u3059\u308b\u30ed\u30fc\u30ab\u30eb \u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u30ad\u30fc\u30b9\u30c8\u30ed\u30fc\u30af\u306e\u76e3\u8996\u306b\u3088\u3063\u3066 \u201c\u76d7\u3080\u201d \u653b\u6483\u3092\u9632\u3050\u305f\u3081\u3001\u30d5\u30a1\u30a4\u30eb \u30d1\u30b9\u306e\u7de8\u96c6\u30dc\u30c3\u30af\u30b9\u3092\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306b\u3057\u307e\u3057\u305f\u3002\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u5834\u5408\u3001\u30e6\u30fc\u30b6\u30fc\u306f\u30d5\u30a1\u30a4\u30eb\u306e\u53c2\u7167\u30c0\u30a4\u30a2\u30ed\u30b0 \u30dc\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p><\/blockquote>\n<p><a href=\"https:\/\/docs.microsoft.com\/ja-jp\/previous-versions\/msdn10\/dd550608(v=msdn.10)\" title=\"Internet Explorer 8 \u958b\u767a\u8005\u5411\u3051\u6280\u8853\u6982\u8981 | Microsoft Docs\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.microsoft.com\/ja-jp\/previous-versions\/msdn10\/dd550608(v=msdn.10)<\/a> \u3088\u308a<\/p>\n<p>\u3068\u306f\u3044\u3048\u3001 input type=&quot;file&quot; \u3067\u8868\u793a\u3055\u308c\u308b\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u5236\u5fa1\u306b\u306f\u8208\u5473\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u4eca\u56de\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h4 class=\"style4a\">input type=&quot;file&quot; \u306e\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308bVBA\u30de\u30af\u30ed<\/h4>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b\u4e0b\u8a18\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u306f\u81ea\u5df1\u8cac\u4efb\u3067\u884c\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/span><br \/>\n<span style=\"color: #ff0000; font-weight: bold;\">\u203b\u4e0b\u8a18\u30b3\u30fc\u30c9\u306f\u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u4ed5\u69d8\u5909\u66f4\u306b\u3088\u3063\u3066\u3001\u5b9f\u884c\u3067\u304d\u306a\u304f\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  Dim tmpFolderPath As String\r\n  Dim scriptPath As String\r\n  Dim batchPath As String\r\n  Dim dt As String\r\n  Const TemporaryFolder = 2\r\n  Const READYSTATE_COMPLETE = 4\r\n  Const UploadFilePath = &quot;C:\\wk\\tmp\\\u6f22 \u5b57 \u30d5\u30a1\u30a4\u30eb\u30c6_\u30b9_\u30c8.txt&quot; '\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\r\n  \r\n  '\u30b9\u30af\u30ea\u30d7\u30c8\u30fb\u30d0\u30c3\u30c1\u306e\u30d1\u30b9\u8a2d\u5b9a\r\n  dt = Format(Now, &quot;yyyymmddhhnnss&quot;)\r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    tmpFolderPath = .GetSpecialFolder(TemporaryFolder).Path\r\n    scriptPath = .BuildPath(tmpFolderPath, dt &amp; &quot;_SendFilePathToUploadDialog.ps1&quot;)\r\n    batchPath = .BuildPath(tmpFolderPath, dt &amp; &quot;_SendFilePathToUploadDialog.bat&quot;)\r\n  End With\r\n  \r\n  'IE\u64cd\u4f5c\r\n  With CreateObject(&quot;InternetExplorer.Application&quot;)\r\n    .Visible = True\r\n    .Navigate &quot;https:\/\/localhost\/sample\/file.html&quot;\r\n    Do While (.Busy = True) Or (.ReadyState &lt;&gt; READYSTATE_COMPLETE)\r\n      DoEvents\r\n    Loop\r\n    \r\n    '&#x5B;\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e]\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u524d\u306b\u30d1\u30b9\u8a2d\u5b9a\u51e6\u7406\u5b9f\u884c\r\n    SendFilePathToUploadDialog UploadFilePath, scriptPath, batchPath\r\n    .document.getElementsByTagName(&quot;input&quot;)(0).Click\r\n    \r\n    .document.getElementsByTagName(&quot;input&quot;)(1).Click\r\n  End With\r\n  \r\n  Kill scriptPath: Kill batchPath '\u30b9\u30af\u30ea\u30d7\u30c8\u30fb\u30d0\u30c3\u30c1\u524a\u9664\r\nEnd Sub\r\n\r\nPrivate Sub SendFilePathToUploadDialog(ByVal TargetFilePath As String, _\r\n                                       ByVal ScriptFilePath As String, _\r\n                                       ByVal BatchFilePath As String)\r\n'&#x5B;\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e]\u30c0\u30a4\u30a2\u30ed\u30b0\u306b\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u8a2d\u5b9a\r\n  Dim scriptCode As String\r\n  Dim batchCode As String\r\n  \r\n  scriptCode = GetPSCode(TargetFilePath)\r\n  batchCode = &quot;@echo off&quot; &amp; vbCrLf\r\n  batchCode = batchCode &amp; &quot;cd \/d %~dp0&quot; &amp; vbCrLf\r\n  batchCode = batchCode &amp; &quot;PowerShell -NoProfile -ExecutionPolicy Unrestricted &quot;&quot;&quot; &amp; ScriptFilePath &amp; &quot;&quot;&quot;&quot;\r\n  \r\n  '\u30b9\u30af\u30ea\u30d7\u30c8\u30fb\u30d0\u30c3\u30c1\u4f5c\u6210\r\n  CreateScriptFile scriptCode, ScriptFilePath\r\n  CreateScriptFile batchCode, BatchFilePath, &quot;Shift-JIS&quot;\r\n  \r\n  '\u30d0\u30c3\u30c1\u7d4c\u7531\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u5b9f\u884c\r\n  CreateObject(&quot;WScript.Shell&quot;).Run BatchFilePath, 2, False\r\nEnd Sub\r\n\r\nPrivate Sub CreateScriptFile(ByVal Code As String, _\r\n                             ByVal TargetFilePath As String, _\r\n                             Optional ByVal FileCharset As String = &quot;UTF-8&quot;)\r\n'\u30b9\u30af\u30ea\u30d7\u30c8\u30fb\u30d0\u30c3\u30c1\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\r\n  Const adTypeText = 2\r\n  Const adCRLF = -1\r\n  Const adWriteChar = 0\r\n  Const adSaveCreateOverWrite = 2\r\n  \r\n  With CreateObject(&quot;ADODB.Stream&quot;)\r\n    .Type = adTypeText\r\n    .Charset = FileCharset\r\n    .LineSeparator = adCRLF\r\n    .Open\r\n    .WriteText Code, adWriteChar\r\n    .SaveToFile TargetFilePath, adSaveCreateOverWrite\r\n    .Close\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function GetPSCode(ByVal TargetFilePath As String) As String\r\n'PowerShell\u30b3\u30fc\u30c9\u53d6\u5f97\r\n  Dim s As String\r\n  \r\n  s = &quot;$source = @&quot;&quot;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;using System;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;using System.Windows.Automation;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;namespace UIAutTools&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;{&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;  public class Program&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;  {&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;    public static void SendFilePathToUploadDialog(string filePath)&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;    {&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      System.Threading.Thread.Sleep(2000); \/\/\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u5f85\u3061&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndDialogName = new PropertyCondition(AutomationElement.NameProperty, &quot;&quot;\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndDialogClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;&quot;#32770&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AndCondition cndDialog = new AndCondition(new Condition&#x5B;] {cndDialogName, cndDialogClassName});&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AutomationElement elmDialog = AutomationElement.RootElement.FindFirst(TreeScope.Subtree, cndDialog);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      &quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndFileNameEditCtrlName = new PropertyCondition(AutomationElement.NameProperty, &quot;&quot;\u30d5\u30a1\u30a4\u30eb\u540d(N):&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndFileNameEditCtrlClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;&quot;Edit&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AndCondition cndFileNameEditCtrl = new AndCondition(new Condition&#x5B;] {cndFileNameEditCtrlName, cndFileNameEditCtrlClassName});&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AutomationElement elmFileNameEditCtrl = elmDialog.FindFirst(TreeScope.Subtree, cndFileNameEditCtrl);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      if (elmFileNameEditCtrl != null)&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      {&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;        ValuePattern vptn = elmFileNameEditCtrl.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;        vptn.SetValue(@filePath);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      }&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      &quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndOpenButtonName = new PropertyCondition(AutomationElement.NameProperty, &quot;&quot;\u958b\u304f(O)&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      PropertyCondition cndOpenButtonClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;&quot;Button&quot;&quot;);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AndCondition cndOpenButton = new AndCondition(new Condition&#x5B;] {cndOpenButtonName, cndOpenButtonClassName});&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      AutomationElement elmOpenButton = elmDialog.FindFirst(TreeScope.Subtree, cndOpenButton);&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      if (elmOpenButton != null)&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      {&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;        InvokePattern iptn = elmOpenButton.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;        iptn.Invoke();&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;      }&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;    }&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;  }&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;}&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;&quot;&quot;@&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;Add-Type -TypeDefinition $source -ReferencedAssemblies(&quot;&quot;UIAutomationClient&quot;&quot;, &quot;&quot;UIAutomationTypes&quot;&quot;)&quot; &amp; vbCrLf\r\n  s = s &amp; &quot;&#x5B;UIAutTools.Program]::SendFilePathToUploadDialog(&quot;&quot;&quot; &amp; TargetFilePath &amp; &quot;&quot;&quot;)&quot;\r\n  \r\n  GetPSCode = s\r\nEnd Function<\/pre>\n<h4 class=\"style4a\">\u52d5\u4f5c\u753b\u9762<\/h4>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_01.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_01.gif\" alt=\"\" width=\"1066\" height=\"748\" class=\"alignnone size-full wp-image-13424\" \/><\/a><\/p>\n<h4 class=\"style4a\">\u51e6\u7406\u6982\u8981<\/h4>\n<p>\u4e0a\u8a18\u30de\u30af\u30ed\u3067\u884c\u3063\u3066\u3044\u308b\u51e6\u7406\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306ePowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210<\/li>\n<li>PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u30d0\u30c3\u30c1\u4f5c\u6210<\/li>\n<li>Internet Explorer\u3092\u64cd\u4f5c\u3057\u3066\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a<\/li>\n<li>PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30c0\u30a4\u30a2\u30ed\u30b0\u5236\u5fa1<\/li>\n<\/ol>\n<h4 class=\"style4a\">\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306ePowerShell\u30b9\u30af\u30ea\u30d7\u30c8<\/h4>\n<p>\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308b\u305f\u3081\u306ePowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">$source = @&quot;\r\nusing System;\r\nusing System.Windows.Automation;\r\n\r\nnamespace UIAutTools\r\n{\r\n  public class Program\r\n  {\r\n    public static void SendFilePathToUploadDialog(string filePath)\r\n    {\r\n      System.Threading.Thread.Sleep(2000); \/\/\u30c0\u30a4\u30a2\u30ed\u30b0\u8868\u793a\u5f85\u3061\r\n      PropertyCondition cndDialogName = new PropertyCondition(AutomationElement.NameProperty, &quot;\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e&quot;);\r\n      PropertyCondition cndDialogClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;#32770&quot;);\r\n      AndCondition cndDialog = new AndCondition(new Condition&#x5B;] {cndDialogName, cndDialogClassName});\r\n      AutomationElement elmDialog = AutomationElement.RootElement.FindFirst(TreeScope.Subtree, cndDialog);\r\n      \r\n      PropertyCondition cndFileNameEditCtrlName = new PropertyCondition(AutomationElement.NameProperty, &quot;\u30d5\u30a1\u30a4\u30eb\u540d(N):&quot;);\r\n      PropertyCondition cndFileNameEditCtrlClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;Edit&quot;);\r\n      AndCondition cndFileNameEditCtrl = new AndCondition(new Condition&#x5B;] {cndFileNameEditCtrlName, cndFileNameEditCtrlClassName});\r\n      AutomationElement elmFileNameEditCtrl = elmDialog.FindFirst(TreeScope.Subtree, cndFileNameEditCtrl);\r\n      if (elmFileNameEditCtrl != null)\r\n      {\r\n        ValuePattern vptn = elmFileNameEditCtrl.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;\r\n        vptn.SetValue(@filePath);\r\n      }\r\n      \r\n      PropertyCondition cndOpenButtonName = new PropertyCondition(AutomationElement.NameProperty, &quot;\u958b\u304f(O)&quot;);\r\n      PropertyCondition cndOpenButtonClassName = new PropertyCondition(AutomationElement.ClassNameProperty, &quot;Button&quot;);\r\n      AndCondition cndOpenButton = new AndCondition(new Condition&#x5B;] {cndOpenButtonName, cndOpenButtonClassName});\r\n      AutomationElement elmOpenButton = elmDialog.FindFirst(TreeScope.Subtree, cndOpenButton);\r\n      if (elmOpenButton != null)\r\n      {\r\n        InvokePattern iptn = elmOpenButton.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;\r\n        iptn.Invoke();\r\n      }\r\n    }\r\n  }\r\n}\r\n&quot;@\r\nAdd-Type -TypeDefinition $source -ReferencedAssemblies(&quot;UIAutomationClient&quot;, &quot;UIAutomationTypes&quot;)\r\n&#x5B;UIAutTools.Program]::SendFilePathToUploadDialog(&quot;** \u30d5\u30a1\u30a4\u30eb\u30d1\u30b9 **&quot;)<\/pre>\n<p>\u666e\u901a\u306e\u30c0\u30a4\u30a2\u30ed\u30b0\u5236\u5fa1\u306a\u3089UI Automation\u306e\u51e6\u7406\u3060\u3051\u3067\u5b8c\u7d50\u3067\u304d\u308b\u306f\u305a\u3067\u3059\u304c\u3001PowerShell\u3068\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u3088\u308b\u4ed5\u69d8\u306e\u305b\u3044\u304b\u3001\u4e0b\u8a18\u30b5\u30a4\u30c8\u8a18\u8f09\u306e\u7f60\u306b\u30ac\u30c3\u30c4\u30ea\u3068\u30cf\u30de\u308a\u307e\u3057\u305f\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/qiita.com\/mima_ita\/items\/3f2aa49fceca7496c587\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=qiita.com\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">Qiita<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/02f4dfc39658231e4aaf63e85060d50c9ac23fde714f079834a2f46db760351c.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">PowerShell\u306eUIAutomation\u306f\u8907\u96d1\u602a\u5947\u306a\u308a - Qiita<\/div><div class=\"lkc-url\" title=\"https:\/\/qiita.com\/mima_ita\/items\/3f2aa49fceca7496c587\">https:\/\/qiita.com\/mima_ita\/items\/3f2aa49fceca7496c587<\/div><div class=\"lkc-excerpt\">#\u3069\u307c\u3062\u3067\u3046\u3054\u304b\u306a\u3044\u306e\u3049\u304a\u304a\u304a\u304a\uff01\uff01C#\u3067\u306f\u52d5\u3044\u305f\u3067\u3057\u3087\u3046\uff01\uff01\uff01\uff01\uff01PowerShell\u306eUIAutomation\u3092\u4f7f\u3063\u3066\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u64cd\u4f5c\u3057\u3066\u3044\u308b\u3068\u3001\u305f\u307e\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u64cd\u4f5c\u306b\u5931\u6557\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002C#\u3084VB.NET,\u3055\u3089\u306b\u306fV...<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<p>\u79c1\u306e\u74b0\u5883\u3067\u306f\u3001\u30c0\u30a4\u30a2\u30ed\u30b0\u304b\u3089AutomationElement\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u306e\u307f\u3092C#\u306b\u6295\u3052\u305f\u5834\u5408\u3067\u3082\u5fc5\u8981\u306a\u8981\u7d20\u304c\u53d6\u5f97\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u5236\u5fa1\u90e8\u5206\u3059\u3079\u3066\u3092C#\u3067\u66f8\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h4 class=\"style4a\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306b\u3088\u308a\u5b9f\u884c\u3067\u304d\u306a\u3044PowerShell\u306e\u51e6\u7406<\/h4>\n<p>\u6700\u521d\u306f\u4e0a\u8a18PowerShell\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30a8\u30f3\u30b3\u30fc\u30c9\u3057\u3066\u3001<a href=\"https:\/\/www.paloaltonetworks.jp\/company\/in-the-news\/2017\/unit-42-pulling-back-curtains-encodedcommand-powershell-attacks\" title=\"EncodedCommand\u306b\u3088\u308bPowerShell\u653b\u6483\u3092\u66b4\u304f - Palo Alto Networks\" target=\"_blank\" rel=\"noopener\">EncodedCommand<\/a>\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6e21\u305d\u3046\u3068\u8003\u3048\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3044\u3056\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b<span style=\"color: #ff0000; font-weight: bold;\">\u201c\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306b\u5f71\u97ff\u3092\u53ca\u307c\u3059\u53ef\u80fd\u6027\u306e\u3042\u308b\u554f\u984c\u70b9\u304c\u691c\u77e5\u3055\u308c\u307e\u3057\u305f\u201d<\/span>\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u3001\u5b9f\u884c\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_03.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_03.png\" alt=\"\" width=\"389\" height=\"279\" class=\"alignnone size-full wp-image-13428\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_03.png 389w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_UploadFileByInputTypeFile_03-300x215.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><\/p>\n<p>\u3084\u308d\u3046\u3068\u3057\u3066\u3044\u308b\u3053\u3068\u306f<a href=\"https:\/\/bs-square.jp\/bromium_blog\/2019\/05\/22\/post-753\/\" title=\"Emotet (Part 2\/3) : \u6355\u307e\u308b\u3082\u3093\u306a\u3089\u6355\u307e\u3048\u3066\u307f\u306a\uff01 | Bromium\u30d6\u30ed\u30b0\" target=\"_blank\" rel=\"noopener\">Emotet<\/a>\u307f\u305f\u3044\u306a\u3082\u306e\u306a\u306e\u3067\u3001\u30d6\u30ed\u30c3\u30af\u3055\u308c\u308b\u306e\u3082\u5f53\u7136\u3068\u8a00\u3048\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u81f4\u3057\u65b9\u306a\u3044\u306e\u3067\u3001PowerShell\u30d5\u30a1\u30a4\u30eb(ps1)\u3092\u4e00\u6642\u7684\u306b\u4f5c\u6210\u3057\u3001\u305d\u308c\u3092\u30d0\u30c3\u30c1\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u5b9f\u884c\u3059\u308b\u5f62\u3092\u3068\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n<h4 class=\"style4a\">\u304a\u308f\u308a\u306b<\/h4>\n<p>\u4e0a\u8a18\u306e\u901a\u308a\u3001\u534a\u3070\u7121\u7406\u3084\u308a\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u4e0a\u3067\u66f8\u3044\u305f\u30de\u30af\u30ed\u3082\u3044\u3064\u4f7f\u3048\u306a\u304f\u306a\u308b\u304b\u5206\u304b\u308a\u307e\u305b\u3093\u3057\u3001\u3084\u306f\u308a<span style=\"color: #ff0000; font-weight: bold;\"> input type=&quot;file&quot; \u306e\u81ea\u52d5\u5316\u306f\u8003\u3048\u306a\u3044\u65b9\u304c\u826f\u3044<\/span>\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u5834\u5408\u306b\u3088\u3063\u3066\u306f\u3001\u4e0b\u8a18\u30b5\u30a4\u30c8\u306e\u3088\u3046\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u51e6\u7406\u3092\u81ea\u524d\u3067\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u306e\u3067\u3001 input type=&quot;file&quot; \u306e\u5236\u5fa1\u3092\u884c\u3046\u524d\u306b\u3001\u307e\u305a\u306f\u4ed6\u306b\u3067\u304d\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/doruby.jp\/users\/ookouchi\/entries\/201708-EXCEL-VBA-API-FileUpload-multipart_form_data\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=doruby.jp\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">DoRuby<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/8f1f4b9c58b7056bbba15f5e271ddadb72de6e8939e1e69a2e72e68816141327.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">EXCEL(VBA)\u304b\u3089\u3001HTTP\u901a\u4fe1\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u307f\u3088\u3046\u3002<\/div><div class=\"lkc-url\" title=\"https:\/\/doruby.jp\/users\/ookouchi\/entries\/201708-EXCEL-VBA-API-FileUpload-multipart_form_data\">https:\/\/doruby.jp\/users\/ookouchi\/entries\/201708-EXCEL-VBA-API-FileUpload-multipart_form_data<\/div><div class=\"lkc-excerpt\">DoRuby\u306f\u3001\u682a\u5f0f\u4f1a\u793eAppirits(\u30a2\u30d4\u30ea\u30c3\u30c4)\u304c\u904b\u55b6\u3059\u308bWeb\u6280\u8853\u30fb\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u60c5\u5831\u767a\u4fe1\u30d6\u30ed\u30b0\u3067\u3059\u3002Ruby on Rails\u3092\u4e2d\u5fc3\u306b\u958b\u767a\u73fe\u5834\u306a\u3089\u3067\u306f\u306e\u5b9f\u8df5\u7684\u306a\u60c5\u5831\u3092\u968f\u6642\u63b2\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<h4 class=\"style4a\">\u95a2\u9023\u8a18\u4e8b<\/h4>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=4855\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-OfficeVBA-120x120.png' alt='VBA\u3067\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2014.09.08<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=4855\">VBA\u3067\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002 <\/a><\/div><div class=\"cardlink_excerpt\">\u300cVBA \u30d5\u30a1\u30a4\u30eb \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u300d\u3068\u3044\u3063\u305f\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u3067\u306e\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002\r\n\r\nOffice\u7cfb\u306eQ&amp;A\u30b5\u30a4\u30c8\u3092\u898b\u3066\u3082\u300cVBA\u3067\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u3044\u300d\u3068\u3044\u3046\u8981\u671b\u306f\u591a\u3044\u3088\u3046\u306a\u306e\u3067\u3001\u8272\u3005\u306a\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"\u4e45\u3057\u3076\u308a\u306eVBA\u30cd\u30bf\u3067\u3059\u3002 \u300cInternet Explorer\u3092\u64cd\u4f5c\u3057\u3066 input type=&quot;file&quot; \u3067\u8868\u793a\u3055\u308c\u308b\u201c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0\u201d\u3092\u5236\u5fa1\u3067\u304d\u306a\u3044\u304b\uff1f\u300d\u3068\u306e\u3054\u8cea\u554f\u3092 [&hellip;]","protected":false},"author":1,"featured_media":7120,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[input type file\u306e\u300c\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u300d\u30c0\u30a4\u30a2\u30ed\u30b0\u3092\u5236\u5fa1\u3059\u308bVBA\u30de\u30af\u30ed]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48],"tags":[],"class_list":["post-13423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-OfficeVBA.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-3uv","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13423","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=13423"}],"version-history":[{"count":3,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13423\/revisions"}],"predecessor-version":[{"id":13429,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13423\/revisions\/13429"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7120"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}