{"id":6076,"date":"2015-08-14T11:29:25","date_gmt":"2015-08-14T02:29:25","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6076"},"modified":"2015-08-26T10:41:50","modified_gmt":"2015-08-26T01:41:50","slug":"%e8%b5%b7%e5%8b%95%e4%b8%ad%e3%81%aemicrosoft-edge%e3%81%8b%e3%82%89%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%a8url%e3%82%92%e5%8f%96%e5%be%97%e3%81%99%e3%82%8bvba%e3%83%9e%e3%82%af%e3%83%adui-autom","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6076","title":{"rendered":"\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8)"},"content":{"rendered":"<p>\u5f53\u30d6\u30ed\u30b0\u3067\u306f\u3001Microsoft Edge\u3092\u5916\u90e8\u304b\u3089\u64cd\u4f5c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3064\u3044\u3066\u3001\u3044\u304f\u3064\u304b\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u8d77\u52d5\u4e2d\u306eEdge\u304b\u3089\u958b\u3044\u3066\u3044\u308bWeb\u30da\u30fc\u30b8\u306e\u30bf\u30a4\u30c8\u30eb\u3092URL\u3092\u53d6\u5f97\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u4f7f\u3046\u306e\u306f VBA + UI Automation\u3067\u3059\u3002<\/p>\n<h4 class=\"style4a\">\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed<\/h4>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPrivate Declare Sub Sleep Lib &quot;kernel32&quot; (ByVal dwMilliseconds As Long)\r\n\r\nPublic Sub ListEdgeTabInfo()\r\n'\u8d77\u52d5\u4e2d\u306eEdge\u306e\u30bf\u30d6\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\r\n'\u203b UIAutomationClient(UIAutomationCore.dll)\u8981\u53c2\u7167\r\n'\u203b Edge\u304c\u6700\u5c0f\u5316\u72b6\u614b\u306e\u5834\u5408\u306f\u5b9f\u884c\u4e0d\u53ef\r\n  Dim uiAuto As UIAutomationClient.CUIAutomation\r\n  Dim elmDesktop As UIAutomationClient.IUIAutomationElement\r\n  Dim elmEdge As UIAutomationClient.IUIAutomationElement\r\n  Dim elmCoreWindow As UIAutomationClient.IUIAutomationElement\r\n  Dim elmTabsList As UIAutomationClient.IUIAutomationElement\r\n  Dim cndWindowControls As UIAutomationClient.IUIAutomationCondition\r\n  Dim cndCoreWindow As UIAutomationClient.IUIAutomationCondition\r\n  Dim cndTabsList As UIAutomationClient.IUIAutomationCondition\r\n  Dim cndListItems As UIAutomationClient.IUIAutomationCondition\r\n  Dim aryWindowControls As UIAutomationClient.IUIAutomationElementArray\r\n  Dim aryListItems As UIAutomationClient.IUIAutomationElementArray\r\n  Dim ptnSelectionItem As UIAutomationClient.IUIAutomationSelectionItemPattern\r\n  Dim i As Long\r\n  \r\n  '\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u53d6\u5f97\r\n  Set uiAuto = New UIAutomationClient.CUIAutomation\r\n  Set elmDesktop = uiAuto.GetRootElement\r\n  \r\n  'Edge\u53d6\u5f97\r\n  Set cndWindowControls = uiAuto.CreatePropertyCondition(UIA_ControlTypePropertyId, UIA_WindowControlTypeId)\r\n  Set aryWindowControls = elmDesktop.FindAll(TreeScope_Subtree, cndWindowControls)\r\n  For i = 0 To aryWindowControls.Length - 1\r\n    If LCase(aryWindowControls.GetElement(i).CurrentName) Like &quot;*microsoft edge&quot; And _\r\n       aryWindowControls.GetElement(i).CurrentClassName = &quot;ApplicationFrameWindow&quot; Then\r\n      Set elmEdge = aryWindowControls.GetElement(i)\r\n      Exit For\r\n    End If\r\n  Next\r\n  If elmEdge Is Nothing Then Exit Sub\r\n  \r\n  '\u5404\u30bf\u30d6\u53d6\u5f97\r\n  Set cndCoreWindow = uiAuto.CreatePropertyCondition(UIA_ClassNamePropertyId, &quot;Windows.UI.Core.CoreWindow&quot;)\r\n  Set elmCoreWindow = elmEdge.FindFirst(TreeScope_Subtree, cndCoreWindow)\r\n  If elmCoreWindow Is Nothing Then Exit Sub\r\n  Set cndTabsList = uiAuto.CreatePropertyCondition(UIA_AutomationIdPropertyId, &quot;TabsList&quot;)\r\n  Set elmTabsList = elmCoreWindow.FindFirst(TreeScope_Subtree, cndTabsList)\r\n  If elmTabsList Is Nothing Then Exit Sub\r\n  Set cndListItems = uiAuto.CreatePropertyCondition(UIA_ControlTypePropertyId, UIA_ListItemControlTypeId)\r\n  Set aryListItems = elmTabsList.FindAll(TreeScope_Subtree, cndListItems)\r\n  For i = 0 To aryListItems.Length - 1\r\n    Set ptnSelectionItem = aryListItems.GetElement(i).GetCurrentPattern(UIA_SelectionItemPatternId)\r\n    ptnSelectionItem.Select '\u30bf\u30d6\u9078\u629e\r\n    Sleep 300\r\n    Debug.Print aryListItems.GetElement(i).CurrentName, GetTabURL(uiAuto, elmCoreWindow)\r\n  Next\r\nEnd Sub\r\n\r\nPrivate Function GetTabURL(ByVal uiAuto As UIAutomationClient.CUIAutomation, _\r\n                           ByVal elmCoreWindow As UIAutomationClient.IUIAutomationElement) As String\r\n'&#x5B;\u691c\u7d22\u307e\u305f\u306f Web \u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b]\u304b\u3089URL\u53d6\u5f97\r\n  Dim elm As UIAutomationClient.IUIAutomationElement\r\n  Dim cnd As UIAutomationClient.IUIAutomationCondition\r\n  Dim url As String\r\n  \r\n  url = &quot;&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  Set cnd = uiAuto.CreatePropertyCondition(UIA_AutomationIdPropertyId, &quot;addressEditBox&quot;)\r\n  Set elm = elmCoreWindow.FindFirst(TreeScope_Subtree, cnd)\r\n  elm.SetFocus\r\n  Sleep 300\r\n  Set elm = elmCoreWindow.FindFirst(TreeScope_Subtree, cnd) '\u30d5\u30a9\u30fc\u30ab\u30b9\u5f8c\u518d\u53d6\u5f97\r\n  url = elm.GetCurrentPropertyValue(UIA_ValueValuePropertyId)\r\n  On Error GoTo 0\r\n  GetTabURL = url\r\nEnd Function<\/pre>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_01.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/AutomateMicrosoftEdge_UIA_01.gif\" alt=\"AutomateMicrosoftEdge_UIA_01\" width=\"858\" height=\"567\" class=\"alignnone size-full wp-image-6077\" \/><\/a><\/p>\n<p>\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u8d77\u52d5\u4e2d\u306eEdge\u3092\u53d6\u5f97 \u2192 \u5404\u30bf\u30d6\u3092\u53d6\u5f97 \u2192 \u9806\u756a\u306b\u30bf\u30d6\u3092\u30af\u30ea\u30c3\u30af \u2192 [\u691c\u7d22\u307e\u305f\u306f Web \u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b]\u6b04\u304b\u3089URL\u3092\u53d6\u5f97\u3001\u3068\u3044\u3046\u4f5c\u696d\u306e\u81ea\u52d5\u5316\u306a\u306e\u3067\u3059\u304c\u3001\u6b63\u76f4\u9014\u4e2d\u3067\u6295\u3052\u51fa\u3057\u305f\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u5916\u90e8\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u64cd\u4f5c\u3059\u308b\u306e\u306bUI Automation\u306f\u3068\u3066\u3082\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001Inspect\u3067\u69cb\u9020\u3092\u4e00\u3064\u305a\u3064\u78ba\u8a8d\u3057\u3066\u3001\u5404\u30a2\u30a4\u30c6\u30e0\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3084\u30af\u30e9\u30b9\u540d\u3092\u8abf\u3079\u3066\u2026\u3068\u3001\u57fa\u672c\u7684\u306b\u5730\u5473\u3067\u9762\u5012\u306a\u4f5c\u696d\u306e\u9023\u7d9a\u3067\u3059\u3002<\/p>\n<p>\u3057\u304b\u3082\u3001\u672c\u5f53\u306fAPI\u95a2\u6570\u3092\u4f7f\u3044\u305f\u304f\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u308f\u3056\u308f\u3056\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u30cf\u30f3\u30c9\u30eb\u304b\u3089\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u3092\u8fbf\u3063\u3066\u2026\u3068\u3044\u3046\u9060\u56de\u308a\u306a\u3053\u3068\u3092\u3057\u305f\u308f\u3051\u3067\u3059\u304c\u3001\u3069\u3046\u3057\u3066\u3082\u30bf\u30d6\u9078\u629e\u30fb\u30a2\u30c9\u30ec\u30b9\u6b04\u306e\u30d5\u30a9\u30fc\u30ab\u30b9\u51e6\u7406\u5f85\u3061\u304c\u4e0a\u624b\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4ed5\u65b9\u306a\u304fSleep\u3092\u4f7f\u3046\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u201cVBA + UI Automation\u3067Edge\u3092\u30a2\u30ec\u30b3\u30ec\u64cd\u4f5c\u3059\u308b\u306e\u306f\u6b62\u3081\u305f\u65b9\u304c\u826f\u3044\u201d<\/span><\/p>\n<p>\u3068\u3044\u3046\u306e\u304c\u79c1\u306e\u611f\u60f3\u3067\u3059\u304c\u3001\u3053\u3093\u306a\u30b3\u30fc\u30c9\u3082\u3069\u306a\u305f\u304b\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<h4 class=\"style4a\">\u95a2\u9023\u8a18\u4e8b<\/h4>\n<ul>\n<li>Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(WebDriver\u7de8)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6018\" target=\"_blank\" title=\"Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(WebDriver\u7de8)\">\/\/www.ka-net.org\/blog\/?p=6018<\/a><\/li>\n<li>PowerShell\u3067Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308b<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6029\" target=\"_blank\" title=\"PowerShell\u3067Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308b\">\/\/www.ka-net.org\/blog\/?p=6029<\/a><\/li>\n<li>Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6033\" target=\"_blank\" title=\"Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)\">\/\/www.ka-net.org\/blog\/?p=6033<\/a><\/li>\n<li>\u7d9a\u30fbMicrosoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6068\" target=\"_blank\" title=\"\u7d9a\u30fbMicrosoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)\">\/\/www.ka-net.org\/blog\/?p=6068<\/a><\/li>\n<li>Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBScript<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6129\" target=\"_blank\" title=\"Microsoft Edge\u3092\u64cd\u4f5c\u3059\u308bVBScript\">\/\/www.ka-net.org\/blog\/?p=6129<\/a><\/li>\n<li>\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6076\" target=\"_blank\" title=\"\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8)\">\/\/www.ka-net.org\/blog\/?p=6076<\/a><\/li>\n<li>\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6086\" target=\"_blank\" title=\"\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(DOM\u7de8)\">\/\/www.ka-net.org\/blog\/?p=6086<\/a><\/li>\n<li>Microsoft Edge\u3067Web\u30da\u30fc\u30b8\u3092\u958b\u304f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6040\" target=\"_blank\" title=\"Microsoft Edge\u3067Web\u30da\u30fc\u30b8\u3092\u958b\u304f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\">\/\/www.ka-net.org\/blog\/?p=6040<\/a><\/li>\n<li>Microsoft Edge\u3092\u8d77\u52d5\u3059\u308bVBScript<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6048\" target=\"_blank\" title=\"Microsoft Edge\u3092\u8d77\u52d5\u3059\u308bVBScript\">\/\/www.ka-net.org\/blog\/?p=6048<\/a><\/li>\n<li>Microsoft Edge\u3067\u30ea\u30f3\u30af\u5148\u3092\u958b\u304f<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6050\" target=\"_blank\" title=\"Microsoft Edge\u3067\u30ea\u30f3\u30af\u5148\u3092\u958b\u304f\">\/\/www.ka-net.org\/blog\/?p=6050<\/a><\/li>\n<li>\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u5b9f\u884c\u300d\u304b\u3089Microsoft Edge\u3092\u8d77\u52d5\u3059\u308b<\/li>\n<li style=\"list-style-type:none;\"><a href=\"\/\/www.ka-net.org\/blog\/?p=6098\" target=\"_blank\" title=\"\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u5b9f\u884c\u300d\u304b\u3089Microsoft Edge\u3092\u8d77\u52d5\u3059\u308b\">\/\/www.ka-net.org\/blog\/?p=6098<\/a><\/li>\n","protected":false},"excerpt":{"rendered":"\u5f53\u30d6\u30ed\u30b0\u3067\u306f\u3001Microsoft Edge\u3092\u5916\u90e8\u304b\u3089\u64cd\u4f5c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3064\u3044\u3066\u3001\u3044\u304f\u3064\u304b\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u8d77\u52d5\u4e2d\u306eEdge\u304b\u3089\u958b\u3044\u3066\u3044\u308bWeb\u30da\u30fc\u30b8\u306e\u30bf\u30a4\u30c8\u30eb\u3092URL\u3092\u53d6\u5f97\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u4f7f\u3046\u306e\u306f  [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u4eca\u56de\u3082\u8ab0\u3082\u5f97\u3057\u306a\u3044\u3088\u3046\u306a\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002 [\u8d77\u52d5\u4e2d\u306eMicrosoft Edge\u304b\u3089\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed(UI Automation\u7de8)]","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":[48,132,4,25,133],"tags":[],"class_list":["post-6076","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-office","category-windows10","category-office","category-windows","category-microsoft-edge"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1A0","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6076","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=6076"}],"version-history":[{"count":6,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6076\/revisions"}],"predecessor-version":[{"id":6144,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6076\/revisions\/6144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}