-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#SingleInstance Force | ||
#Persistent | ||
#NoEnv | ||
SetTitleMatchMode, 2 | ||
SizeOfMovement=50 ; in pixels | ||
TimeToPoll=10 ; ms - Time to Poll. | ||
|
||
Loop | ||
{ | ||
IfWinNotActive, Notepad ; Thus we only ever use this behavior in Notepad | ||
{ | ||
Sleep 500 ; Optional. I don't know if this has any positive effect on script performance. | ||
Continue | ||
} | ||
MouseGetPos, VarX1, VarY1 | ||
Sleep TimeToPoll | ||
MouseGetPos, VarX2, VarY2 | ||
VarX:=VarX1-VarX2 | ||
VarY:=VarY1-VarY2 | ||
|
||
If(VarX>SizeOfMovement) ; if VarX1 was greater than VarX2, and that difference is greater than 50 | ||
Send {Left} | ||
If(VarX<-SizeOfMovement) | ||
Send {Right} | ||
If(VarY>SizeOfMovement) | ||
Send {Up} | ||
If(VarY<-SizeOfMovement) | ||
Send {Down} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#SingleInstance Force | ||
#Persistent | ||
#NoEnv | ||
SetBatchLines, -1 | ||
SetDefaultMouseSpeed, 0 | ||
SetMouseDelay, 2 ;Change this number here to control the mouse speed. (the lower the number the faster the mouse speed & the higher the number the slower the mouse speed) | ||
|
||
Up:: | ||
Key = Up | ||
X = 0 | ||
Y = -1 | ||
Goto, Move_Mouse | ||
|
||
Down:: | ||
Key = Down | ||
X = 0 | ||
Y = 1 | ||
Goto, Move_Mouse | ||
|
||
Left:: | ||
Key = Left | ||
X = -1 | ||
Y = 0 | ||
Goto, Move_Mouse | ||
|
||
Right:: | ||
Key = Right | ||
X = 1 | ||
Y = 0 | ||
Goto, Move_Mouse | ||
|
||
|
||
|
||
Move_Mouse: | ||
Loop | ||
{ | ||
MouseMove, %X%, %Y%, , R | ||
GetKeyState, State, %Key%, P | ||
If State = U | ||
Break | ||
} | ||
Return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<job><script language="VBScript"> | ||
Option Explicit | ||
|
||
On Error Resume Next | ||
|
||
Dim objWMIService | ||
Dim objNetAdapter | ||
Dim strComputer | ||
Dim arrIPAddress | ||
Dim arrSubnetMask | ||
Dim arrGateway | ||
Dim colNetAdapters | ||
Dim errEnableStatic | ||
Dim errGateways | ||
Dim strInput | ||
Dim errFailed | ||
|
||
errFailed = 0 | ||
|
||
Dim response = MsgBox("title", MsgBoxStyle.YesNo, "Hospital-DHCP switcher") | ||
|
||
If response = MsgBoxResult.Yes Then | ||
|
||
strComputer = "." | ||
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | ||
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") | ||
|
||
For Each objNetAdapter in colNetAdapters | ||
errEnable = objNetAdapter.EnableDHCP() | ||
If Not errEnable = 0 Then | ||
WScript.Echo "Setting DHCP Failed." | ||
errFailed = 1 | ||
End If | ||
Next | ||
Else | ||
strComputer = "." | ||
arrIPAddress = Array("192.168.81.95") | ||
arrSubnetMask = Array("255.255.255.0") | ||
arrGateway = Array("192.168.81.1") | ||
|
||
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | ||
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") | ||
|
||
For Each objNetAdapter in colNetAdapters | ||
errEnableStatic = objNetAdapter.EnableStatic(arrIPAddress, arrSubnetMask) | ||
If Not errEnableStatic = 0 Then | ||
WScript.Echo "Failure assigning IP/Subnet." | ||
errFailed = 1 | ||
End If | ||
|
||
errGateways = objNetAdapter.SetGateways(arrGateway) | ||
If Not errGateways = 0 Then | ||
WScript.Echo "Failure assigning Gateway." | ||
errFailed = 1 | ||
End If | ||
|
||
Next | ||
|
||
End If | ||
|
||
If errFailed = 0 Then | ||
|
||
WScript.Echo "IP Settings Successfully Modified." | ||
|
||
End If | ||
|
||
WScript.Quit | ||
</script></job> |