-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathSeMouseClickActionCompleter.ps1
31 lines (28 loc) · 1.8 KB
/
SeMouseClickActionCompleter.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$Script:SeMouseClickAction = @(
New-Condition -Text 'Click' -Tooltip 'Clicks the mouse on the specified element.'
New-Condition -Text 'Click_JS' -ElementRequired $true -Tooltip 'Clicks the mouse on the specified element using Javascript.'
New-Condition -Text 'ClickAndHold' -Tooltip 'Clicks and holds the mouse button down on the specified element.'
New-Condition -Text 'ContextClick' -Tooltip 'Right-clicks the mouse on the specified element.'
New-Condition -Text 'DoubleClick' -Tooltip 'Double-clicks the mouse on the specified element.'
New-Condition -Text 'Release' -Tooltip 'Releases the mouse button at the last known mouse coordinates or specified element.'
)
class SeMouseClickActionCompleter : System.Management.Automation.IArgumentCompleter {
[System.Collections.Generic.IEnumerable[System.Management.Automation.CompletionResult]] CompleteArgument(
[string] $CommandName ,
[string] $ParameterName,
[string] $WordToComplete,
[System.Management.Automation.Language.CommandAst] $CommandAst,
[system.Collections.IDictionary] $FakeBoundParameters
) {
$wildcard = ("*" + $wordToComplete + "*")
$CompletionResults = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
$pvalue = [System.Management.Automation.CompletionResultType]::ParameterValue
$Script:SeMouseClickAction.where( { $_.Text -like $wildcard }) |
ForEach-Object {
$Valuetype = $_.ValueType
if ($null -eq $ValueType) { $Valuetype = 'None' }
$CompletionResults.Add(([System.Management.Automation.CompletionResult]::new($_.Text, $_.Text, $pvalue, $_.Tooltip) ) )
}
return $CompletionResults
}
}