@synthetic-ai/ae-mcp 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.mjs +1 -1
- package/dist/server.mjs +2 -2
- package/dist/store.mjs +1 -1
- package/package.json +51 -50
- package/scripts/ae-dialogs.ps1 +129 -0
package/dist/store.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1d8635,_0x43ff01){const _0x30e0ee={_0x4b858a:0x24e,_0xc2ee70:0x250,_0x4fc17d:0x254,_0x37977c:0x54,_0x457dd5:0x64,_0x4f4104:0x57,_0x4a4407:0x6e,_0x5d3fc1:0x24c,_0x37227c:0x245},_0xd6c2de={_0x373bbd:0xe7};function _0x3b7af3(_0x29262a,_0xc9a75a){return _0x6db9(_0xc9a75a- -_0xd6c2de._0x373bbd,_0x29262a);}const _0x3991ab=_0x1d8635();function _0xf74ba5(_0x21cde1,_0x142883){return _0x6db9(_0x21cde1-0xf6,_0x142883);}while(!![]){try{const _0x46c8a1=parseInt(_0xf74ba5(0x242,0x242))/0x1+parseInt(_0x3b7af3(0x58,0x62))/0x2*(-parseInt(_0xf74ba5(0x24f,_0x30e0ee._0x4b858a))/0x3)+-parseInt(_0xf74ba5(_0x30e0ee._0xc2ee70,_0x30e0ee._0x4fc17d))/0x4+-parseInt(_0x3b7af3(_0x30e0ee._0x37977c,0x5f))/0x5+-parseInt(_0x3b7af3(_0x30e0ee._0x457dd5,_0x30e0ee._0x4f4104))/0x6+parseInt(_0x3b7af3(_0x30e0ee._0x4a4407,0x66))/0x7+-parseInt(_0xf74ba5(_0x30e0ee._0x5d3fc1,0x249))/0x8*(-parseInt(_0xf74ba5(_0x30e0ee._0x37227c,0x24b))/0x9);if(_0x46c8a1===_0x43ff01)break;else _0x3991ab['push'](_0x3991ab['shift']());}catch(_0x15b609){_0x3991ab['push'](_0x3991ab['shift']());}}}(_0x21a1,0xcf142));import{homedir}from'node:os';function _0x6db9(_0x1aae38,_0x4d4e9a){_0x1aae38=_0x1aae38-0x139;const _0x21a19e=_0x21a1();let _0x6db9e9=_0x21a19e[_0x1aae38];if(_0x6db9['GnjfKu']===undefined){var _0x32176c=function(_0x42b70e){const _0x33a361='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x389eed='',_0x3832dd='';for(let _0x1a8fab=0x0,_0x2a90e6,_0x50692f,_0x221e46=0x0;_0x50692f=_0x42b70e['charAt'](_0x221e46++);~_0x50692f&&(_0x2a90e6=_0x1a8fab%0x4?_0x2a90e6*0x40+_0x50692f:_0x50692f,_0x1a8fab++%0x4)?_0x389eed+=String['fromCharCode'](0xff&_0x2a90e6>>(-0x2*_0x1a8fab&0x6)):0x0){_0x50692f=_0x33a361['indexOf'](_0x50692f);}for(let _0x132d24=0x0,_0x5aa27b=_0x389eed['length'];_0x132d24<_0x5aa27b;_0x132d24++){_0x3832dd+='%'+('00'+_0x389eed['charCodeAt'](_0x132d24)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3832dd);};_0x6db9['oOZaev']=_0x32176c,_0x6db9['JNWepN']={},_0x6db9['GnjfKu']=!![];}const _0x563db5=_0x21a19e[0x0],_0x20349f=_0x1aae38+_0x563db5,_0xb1611=_0x6db9['JNWepN'][_0x20349f];return!_0xb1611?(_0x6db9e9=_0x6db9['oOZaev'](_0x6db9e9),_0x6db9['JNWepN'][_0x20349f]=_0x6db9e9):_0x6db9e9=_0xb1611,_0x6db9e9;}import{join}from'node:path';function _0x21a1(){const _0x132891=['lNn5BNrOzxrPyY1Hzs1Ty3a','CgfYC2u','mJe0ota4nMnhDKnruG','ntmYmJCYoeXgrKrpuq','DhLWzq','y29Kzq','BMfTzq','ChvZAa','AgfZt3DUuhjVCgvYDhK','ntqWnduXogzXC1boDa','ChjVDg90ExbL','C3rYAw5NAwz5','B2jQzwn0','Dhj1zq','C3rYAw5N','BNvTyMvY','AxnbCNjHEq','ndy0ndK1nuHHB3fluW','yM9VBgvHBG','CMvXDwLYzwq','mNLMtfjSwa','twLZC2LUzYbYzxf1AxjLzcbWyxjHBwv0zxiGjW','DxrMltG','ndCXmdaYs2XHrxPH','mtm3ndG3mePIsKPhBG','AM9PBG','mty1otKXnvPTEffiCa','AM91CM5HBc5QC29UBa','yxjYyxK','CgfYyw1Z','CMf3','zgvZy3jPChrPB24','DhjPBq','mtC2zgLiC0nw'];_0x21a1=function(){return _0x132891;};return _0x21a1();}import{existsSync,mkdirSync,appendFileSync,readFileSync,writeFileSync}from'node:fs';function _0x4d1892(_0x2479f3,_0x3a48ea){const _0x474b9f={_0x376cd9:0x34f};return _0x6db9(_0x3a48ea-_0x474b9f._0x376cd9,_0x2479f3);}export const DATA_DIR=process.env.AE_MCP_DATA_DIR||join(homedir(),_0x529ecb(0x3f7,0x3e6));export const JOURNAL_PATH=join(DATA_DIR,_0x529ecb(0x3f0,0x3ee));export const WRAPPERS_PATH=join(DATA_DIR,'wrappers.json');function ensureDir(){if(!existsSync(DATA_DIR))mkdirSync(DATA_DIR,{'recursive':!![]});}export function appendJournal(_0x389eed){const _0x2fb8b7={_0x445a45:0x4ae,_0x10eb21:0x6},_0x4a0d3b={_0x13e2f0:0x3eb};function _0x5e5d0b(_0x245996,_0x45daa1){return _0x529ecb(_0x45daa1-0xce,_0x245996);}function _0x856b41(_0x10c79b,_0x161518){return _0x529ecb(_0x161518- -_0x4a0d3b._0x13e2f0,_0x10c79b);}try{ensureDir(),appendFileSync(JOURNAL_PATH,JSON[_0x5e5d0b(0x4af,_0x2fb8b7._0x445a45)](_0x389eed)+'\x0a',_0x856b41(-_0x2fb8b7._0x10eb21,0x0));}catch(_0x3832dd){}}export function readJournal(){const _0x529b90={_0xf471cf:0x3fe,_0x47d086:0x150};function _0x205e4e(_0x19ea42,_0x3fe4cb){return _0x529ecb(_0x3fe4cb- -0x548,_0x19ea42);}function _0xe7614f(_0x7d2e5a,_0xe89b49){return _0x529ecb(_0xe89b49-0x3,_0x7d2e5a);}if(!existsSync(JOURNAL_PATH))return[];const _0x1a8fab=[];for(const _0x2a90e6 of readFileSync(JOURNAL_PATH,_0x205e4e(-0x160,-0x15d))['split']('\x0a')){const _0x50692f=_0x2a90e6[_0xe7614f(_0x529b90._0xf471cf,0x3f8)]();if(!_0x50692f)continue;try{_0x1a8fab[_0x205e4e(-0x17c,-0x16c)](JSON[_0x205e4e(-0x15c,-_0x529b90._0x47d086)](_0x50692f));}catch(_0x221e46){}}return _0x1a8fab;}export function readWrappers(){const _0x296da4={_0x2f2705:0x265},_0x3f04a2={_0x22ae6c:0x70d};if(!existsSync(WRAPPERS_PATH))return[];function _0x473326(_0x2ff006,_0x5bfdc5){return _0x4d1892(_0x2ff006,_0x5bfdc5- -_0x3f04a2._0x22ae6c);}function _0x23fcea(_0x3167cb,_0x47223e){return _0x4d1892(_0x47223e,_0x3167cb- -0x29);}try{const _0x132d24=JSON['parse'](readFileSync(WRAPPERS_PATH,_0x473326(-_0x296da4._0x2f2705,-0x273)));return Array[_0x23fcea(0x46b,0x46b)](_0x132d24)?_0x132d24:[];}catch(_0x5aa27b){return[];}}export function writeWrappers(_0x421ee2){const _0x51de86={_0x3055a7:0x472,_0x28290b:0x467},_0xf87b9b={_0x20c8b6:0x636};function _0x1607e1(_0x2ace73,_0x58470a){return _0x529ecb(_0x2ace73- -_0xf87b9b._0x20c8b6,_0x58470a);}function _0x13fbf3(_0x4933d4,_0x9d3c4d){return _0x529ecb(_0x4933d4-0x92,_0x9d3c4d);}ensureDir(),writeFileSync(WRAPPERS_PATH,JSON[_0x13fbf3(_0x51de86._0x3055a7,_0x51de86._0x28290b)](_0x421ee2,null,0x2),_0x13fbf3(0x47d,0x46f));}const TYPE_TO_SCHEMA={'string':()=>({'type':'string'}),'number':()=>({'type':_0x529ecb(0x3e4,0x3f2)}),'boolean':()=>({'type':_0x529ecb(0x3e7,0x3e3)}),'array':()=>({'type':_0x4d1892(0x4a7,0x4a0)}),'object':()=>({'type':_0x529ecb(0x3e1,0x3e1)}),'raw':()=>({'type':_0x4d1892(0x48f,0x492)})};export function wrapperToToolDef(_0xfacff1){const _0x4f20be={_0x1f55cf:0x21c,_0x4a5d66:0x22d,_0x8f1b62:0x21a,_0x42d2ac:0x223,_0x446b7d:0x4ad,_0x135b39:0x4a1,_0x4927f5:0x4c5,_0x53fbdf:0x4c4},_0xae39a9={_0x120193:0x60e},_0x11bb5c={_0x45fb9b:0xd1};function _0x21c1a2(_0x1ff4d7,_0x4d5c10){return _0x529ecb(_0x1ff4d7-_0x11bb5c._0x45fb9b,_0x4d5c10);}const _0x51f826={},_0x1cccbf=[];for(const _0x58e8a6 of _0xfacff1[_0x538303(-_0x4f20be._0x1f55cf,-_0x4f20be._0x4a5d66)]||[]){const _0x6444a3=(TYPE_TO_SCHEMA[_0x58e8a6[_0x538303(-0x235,-0x234)]]||TYPE_TO_SCHEMA[_0x21c1a2(0x4b4,0x4a5)])();_0x51f826[_0x58e8a6[_0x538303(-0x233,-0x228)]]={..._0x6444a3,'description':_0x58e8a6[_0x538303(-_0x4f20be._0x8f1b62,-_0x4f20be._0x42d2ac)]||''};if(_0x58e8a6[_0x21c1a2(0x4b9,0x4be)])_0x1cccbf[_0x21c1a2(_0x4f20be._0x446b7d,_0x4f20be._0x135b39)](_0x58e8a6[_0x538303(-0x233,-0x224)]);}function _0x538303(_0x587d1c,_0x15ed73){return _0x529ecb(_0x587d1c- -_0xae39a9._0x120193,_0x15ed73);}return{'name':_0xfacff1[_0x21c1a2(0x4ac,0x4af)],'description':(_0xfacff1[_0x21c1a2(_0x4f20be._0x4927f5,_0x4f20be._0x53fbdf)]||'')+'\x20\x20[promoted\x20wrapper]','inputSchema':{'type':_0x21c1a2(0x4b2,0x4bd),'properties':_0x51f826,'required':_0x1cccbf,'additionalProperties':![]}};}function _0x529ecb(_0x13dc97,_0x2b9338){return _0x6db9(_0x13dc97-0x2a0,_0x2b9338);}function renderLiteral(_0x5a0807,_0x5188f7){const _0x9a6a61={_0x34c931:0x393,_0x25b5ab:0x397,_0x27efd2:0x395,_0x3c7683:0x390,_0x12af05:0x4cf,_0x3c9994:0x38e,_0x45e1dc:0x396,_0x3ca8cc:0x3a1,_0x5a1c5a:0x4d9},_0x366da0={_0x47b6a2:0x4b},_0x504203={_0x4269ce:0x101};function _0x1568c0(_0x2a77ac,_0x452fe7){return _0x4d1892(_0x452fe7,_0x2a77ac- -_0x504203._0x4269ce);}function _0x32a8cc(_0x4c721d,_0x59c36e){return _0x4d1892(_0x59c36e,_0x4c721d-_0x366da0._0x47b6a2);}switch(_0x5188f7){case _0x1568c0(0x391,_0x9a6a61._0x34c931):return JSON[_0x1568c0(0x38e,_0x9a6a61._0x25b5ab)](String(_0x5a0807??''));case _0x1568c0(0x392,0x39c):return String(Number(_0x5a0807));case _0x1568c0(_0x9a6a61._0x27efd2,_0x9a6a61._0x3c7683):return _0x5a0807?_0x32a8cc(0x4dc,_0x9a6a61._0x12af05):'false';case'array':case'object':return JSON[_0x1568c0(_0x9a6a61._0x3c9994,_0x9a6a61._0x45e1dc)](_0x5a0807??null);case _0x1568c0(_0x9a6a61._0x3ca8cc,0x3ab):return String(_0x5a0807??'');default:return JSON[_0x32a8cc(0x4da,_0x9a6a61._0x5a1c5a)](String(_0x5a0807??''));}}export function fillTemplate(_0x50fc21,_0x4f1d31){const _0x7cca13={_0x59c3ab:0x107,_0x4cbc8b:0x3b3,_0x253625:0x3bc,_0x38725d:0x3b1,_0x10c4e6:0x3a6,_0x22f0fa:0x3ad,_0x2023f0:0x3c0,_0x2cb98b:0x3c2,_0x3114bd:0x108,_0x4cc355:0x3a4,_0x1a50aa:0x3c4};function _0x33eaca(_0x4c1e96,_0x3d4bfc){return _0x4d1892(_0x3d4bfc,_0x4c1e96- -0xd9);}let _0x281b01=_0x50fc21[_0x162266(-_0x7cca13._0x59c3ab,-0x110)];function _0x162266(_0x37b235,_0x57f13d){return _0x4d1892(_0x57f13d,_0x37b235- -0x590);}for(const _0x1a7e36 of _0x50fc21['params']||[]){const _0x308872=_0x4f1d31&&Object[_0x162266(-0x102,-0x108)][_0x33eaca(_0x7cca13._0x4cbc8b,_0x7cca13._0x253625)]['call'](_0x4f1d31,_0x1a7e36['name']);let _0x132cb5=_0x308872?_0x4f1d31[_0x1a7e36[_0x33eaca(_0x7cca13._0x38725d,_0x7cca13._0x10c4e6)]]:_0x1a7e36['default'];if(_0x132cb5===undefined){if(_0x1a7e36[_0x33eaca(0x3be,_0x7cca13._0x22f0fa)])throw new Error(_0x33eaca(_0x7cca13._0x2023f0,0x3b3)+_0x1a7e36[_0x33eaca(_0x7cca13._0x38725d,_0x7cca13._0x2cb98b)]+'\x27');continue;}const _0x565bbd=renderLiteral(_0x132cb5,_0x1a7e36[_0x162266(-_0x7cca13._0x3114bd,-0xfc)]);_0x281b01=_0x281b01['split']('{{'+_0x1a7e36[_0x33eaca(0x3b1,_0x7cca13._0x4cc355)]+'}}')[_0x33eaca(_0x7cca13._0x1a50aa,0x3c2)](_0x565bbd);}return _0x281b01;}
|
package/package.json
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@synthetic-ai/ae-mcp",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Control Adobe After Effects with 220+ AI tools via MCP. Two modes: Standalone (npx, no AE open) or Panel (CEP bridge, instant). By Synthetic (synthetic.com.ar).",
|
|
6
|
-
"homepage": "https://synthetic.com.ar/ae-mcp",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/matiasEltrece/after-effects-mcp"
|
|
10
|
-
},
|
|
11
|
-
"author": "Synthetic <hola@synthetic.com.ar> (https://synthetic.com.ar)",
|
|
12
|
-
"license": "UNLICENSED",
|
|
13
|
-
"keywords": [
|
|
14
|
-
"mcp",
|
|
15
|
-
"after-effects",
|
|
16
|
-
"adobe",
|
|
17
|
-
"jsx",
|
|
18
|
-
"extendscript",
|
|
19
|
-
"model-context-protocol",
|
|
20
|
-
"claude",
|
|
21
|
-
"ai",
|
|
22
|
-
"synthetic"
|
|
23
|
-
],
|
|
24
|
-
"main": "./dist/server.mjs",
|
|
25
|
-
"bin": {
|
|
26
|
-
"ae-mcp": "./dist/server.mjs"
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist/server.mjs",
|
|
30
|
-
"dist/bridge.mjs",
|
|
31
|
-
"dist/store.mjs"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@synthetic-ai/ae-mcp",
|
|
3
|
+
"version": "2.5.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Control Adobe After Effects with 220+ AI tools via MCP. Two modes: Standalone (npx, no AE open) or Panel (CEP bridge, instant). By Synthetic (synthetic.com.ar).",
|
|
6
|
+
"homepage": "https://synthetic.com.ar/ae-mcp",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/matiasEltrece/after-effects-mcp"
|
|
10
|
+
},
|
|
11
|
+
"author": "Synthetic <hola@synthetic.com.ar> (https://synthetic.com.ar)",
|
|
12
|
+
"license": "UNLICENSED",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"after-effects",
|
|
16
|
+
"adobe",
|
|
17
|
+
"jsx",
|
|
18
|
+
"extendscript",
|
|
19
|
+
"model-context-protocol",
|
|
20
|
+
"claude",
|
|
21
|
+
"ai",
|
|
22
|
+
"synthetic"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/server.mjs",
|
|
25
|
+
"bin": {
|
|
26
|
+
"ae-mcp": "./dist/server.mjs"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/server.mjs",
|
|
30
|
+
"dist/bridge.mjs",
|
|
31
|
+
"dist/store.mjs",
|
|
32
|
+
"scripts/ae-dialogs.ps1"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "node scripts/build.mjs",
|
|
36
|
+
"prepublishOnly": "npm run build",
|
|
37
|
+
"check": "node --check src/server.mjs",
|
|
38
|
+
"inspect:tools": "node scripts/inspect-tools.mjs",
|
|
39
|
+
"smoke": "node scripts/smoke-suite.mjs",
|
|
40
|
+
"package-cep": "node scripts/package-cep.mjs"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"javascript-obfuscator": "^5.4.3"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[ValidateSet("list", "close")]
|
|
3
|
+
[string]$Mode = "list",
|
|
4
|
+
[string]$TitlePattern = "^After Effects$",
|
|
5
|
+
[string]$ButtonPattern = "Aceptar|OK|Accept|Cerrar|Close",
|
|
6
|
+
[switch]$All
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = "Stop"
|
|
10
|
+
|
|
11
|
+
Add-Type -AssemblyName UIAutomationClient
|
|
12
|
+
Add-Type -AssemblyName UIAutomationTypes
|
|
13
|
+
|
|
14
|
+
function Convert-Rect($rect) {
|
|
15
|
+
@{
|
|
16
|
+
left = $rect.Left
|
|
17
|
+
top = $rect.Top
|
|
18
|
+
width = $rect.Width
|
|
19
|
+
height = $rect.Height
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function Get-DescendantText($element) {
|
|
24
|
+
$texts = @()
|
|
25
|
+
$condition = [System.Windows.Automation.Condition]::TrueCondition
|
|
26
|
+
$children = $element.FindAll([System.Windows.Automation.TreeScope]::Descendants, $condition)
|
|
27
|
+
|
|
28
|
+
foreach ($child in $children) {
|
|
29
|
+
$name = $child.Current.Name
|
|
30
|
+
$controlType = $child.Current.ControlType.ProgrammaticName
|
|
31
|
+
if ($name -and $name.Trim().Length -gt 0 -and ($controlType -match "Text|Button|Edit|Document")) {
|
|
32
|
+
$trimmed = $name.Trim()
|
|
33
|
+
if ($texts -notcontains $trimmed) {
|
|
34
|
+
$texts += $trimmed
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return $texts
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function Get-DialogButtons($element) {
|
|
43
|
+
$buttons = @()
|
|
44
|
+
$condition = New-Object System.Windows.Automation.PropertyCondition(
|
|
45
|
+
[System.Windows.Automation.AutomationElement]::ControlTypeProperty,
|
|
46
|
+
[System.Windows.Automation.ControlType]::Button
|
|
47
|
+
)
|
|
48
|
+
$items = $element.FindAll([System.Windows.Automation.TreeScope]::Descendants, $condition)
|
|
49
|
+
|
|
50
|
+
foreach ($button in $items) {
|
|
51
|
+
$buttons += [pscustomobject]@{
|
|
52
|
+
name = $button.Current.Name
|
|
53
|
+
automationId = $button.Current.AutomationId
|
|
54
|
+
enabled = $button.Current.IsEnabled
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return $buttons
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Invoke-DialogButton($element, $pattern) {
|
|
62
|
+
$condition = New-Object System.Windows.Automation.PropertyCondition(
|
|
63
|
+
[System.Windows.Automation.AutomationElement]::ControlTypeProperty,
|
|
64
|
+
[System.Windows.Automation.ControlType]::Button
|
|
65
|
+
)
|
|
66
|
+
$buttons = $element.FindAll([System.Windows.Automation.TreeScope]::Descendants, $condition)
|
|
67
|
+
|
|
68
|
+
foreach ($button in $buttons) {
|
|
69
|
+
if ($button.Current.Name -match $pattern -and $button.Current.IsEnabled) {
|
|
70
|
+
$invokePattern = $button.GetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern)
|
|
71
|
+
$invokePattern.Invoke()
|
|
72
|
+
return $button.Current.Name
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return $null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
|
80
|
+
$windowCondition = New-Object System.Windows.Automation.PropertyCondition(
|
|
81
|
+
[System.Windows.Automation.AutomationElement]::ControlTypeProperty,
|
|
82
|
+
[System.Windows.Automation.ControlType]::Window
|
|
83
|
+
)
|
|
84
|
+
$windows = $root.FindAll([System.Windows.Automation.TreeScope]::Children, $windowCondition)
|
|
85
|
+
$dialogs = @()
|
|
86
|
+
|
|
87
|
+
foreach ($window in $windows) {
|
|
88
|
+
$name = $window.Current.Name
|
|
89
|
+
$className = $window.Current.ClassName
|
|
90
|
+
$processId = $window.Current.ProcessId
|
|
91
|
+
|
|
92
|
+
if (-not $All -and $name -notmatch $TitlePattern) {
|
|
93
|
+
continue
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
$texts = Get-DescendantText $window
|
|
97
|
+
$buttons = Get-DialogButtons $window
|
|
98
|
+
$closedBy = $null
|
|
99
|
+
|
|
100
|
+
if ($Mode -eq "close") {
|
|
101
|
+
$closedBy = Invoke-DialogButton $window $ButtonPattern
|
|
102
|
+
if (-not $closedBy) {
|
|
103
|
+
try {
|
|
104
|
+
$windowPattern = $window.GetCurrentPattern([System.Windows.Automation.WindowPattern]::Pattern)
|
|
105
|
+
$windowPattern.Close()
|
|
106
|
+
$closedBy = "WindowPattern.Close"
|
|
107
|
+
} catch {
|
|
108
|
+
$closedBy = $null
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
$dialogs += [pscustomobject]@{
|
|
114
|
+
title = $name
|
|
115
|
+
className = $className
|
|
116
|
+
processId = $processId
|
|
117
|
+
bounds = Convert-Rect $window.Current.BoundingRectangle
|
|
118
|
+
texts = $texts
|
|
119
|
+
buttons = $buttons
|
|
120
|
+
closedBy = $closedBy
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@{
|
|
125
|
+
ok = $true
|
|
126
|
+
mode = $Mode
|
|
127
|
+
count = $dialogs.Count
|
|
128
|
+
dialogs = @($dialogs)
|
|
129
|
+
} | ConvertTo-Json -Depth 8
|