aardio 文档

aardio 范例: PowerShell

//PowerShell
import FlaUI;
import FlaUI.UIA3;

//PowerShell 支持 aardio 内存加载的程序集,不再需要调用 Add-Type
var pScript = /* 
    # 定义命名参数,参数前加$号,aardio 参数表里去掉$号
    param($exename) 
    $app = [FlaUI.Core.Application]::Launch($exename)
    $uia = New-Object FlaUI.UIA3.UIA3Automation
    $mw = $app.GetMainWindow($uia)

    Write-Host $mw.Title
    $title = $mw.FindFirstChild($uia.ConditionFactory.ByControlType([FlaUI.Core.Definitions.ControlType]::TitleBar))
    $buttons = $title.FindAllChildren($uia.ConditionFactory.ByControlType([FlaUI.Core.Definitions.ControlType]::Button))
    $closeButton = $buttons[2].AsButton()
    $closeButton.Invoke()
    $uia.Dispose()
    $app.Dispose()
*/

import dotNet.ps;

//调用 PowerShell,并传参数(参数名前不需要 $符号)
var output,err = dotNet.ps(pScript,{exename = "EXE 名字"});

/*
aardio 调用 PowerShell 教程: https://mp.weixin.qq.com/s/Sr4HNkOJ1mmAj_V52v69IA
PowerShell 快速入门 https://learnxinyminutes.com/docs/zh-cn/powershell-cn/
*/

//打印错误信息
import console; 
console.log(err);
console.pause();

Markdown 格式