-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclickApp.ps1
70 lines (57 loc) · 1.65 KB
/
clickApp.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
param (
[Parameter(Mandatory=$true, Position=0)]
[int] $X,
[Parameter(Mandatory=$true, Position=1)]
[int] $Y
)
$signature=@'
[DllImport("user32.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
'@
$SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru
Add-Type -AssemblyName System.Windows.Forms
$wshell = New-Object -ComObject wscript.shell
function Make-Move {
Param (
[Parameter(Mandatory=$true, Position=0)]
[int] $X,
[Parameter(Mandatory=$true, Position=1)]
[int] $Y
)
$POSITION = [Windows.Forms.Cursor]::Position
$POSITION.x = $X
$POSITION.y = $Y+3
[Windows.Forms.Cursor]::Position = $POSITION
Start-Sleep -s 2
$SendMouseClick::mouse_event(0x0002, 0, 0, 0, 0);
$SendMouseClick::mouse_event(0x0004, 0, 0, 0, 0);
}
function ConnectVPN {
if ($(Get-VpnConnection -Name "VPN").ConnectionStatus -eq "Disconnected") {
echo "Disconnected"
rasphone
Start-Sleep 2
$wshell.SendKeys('{ENTER}')
}
Start-Sleep 5
}
function Connect {
if (Test-Connection -ComputerName jira -Quiet) {
echo "Connected"
Start-Sleep 4
}
else {
echo "Connecting"
rasphone
Start-Sleep 3
$wshell.SendKeys('{ENTER}')
}
}
Connect
powershell.exe -Command "& 'C:\Program Files (x86)\work.jar'"
Start-Sleep -s 4
Make-Move -X $X -Y $Y
Start-Sleep 2
$wshell.SendKeys('{ENTER}')
#Start-Sleep -s 4
#Make-Move -X 465 -Y 75