Skip to content

Commit 014f22e

Browse files
committed
0.2
Added a little mouse jiggler to prevent remote logoff.
1 parent 1d73b35 commit 014f22e

File tree

4 files changed

+31
-50
lines changed

4 files changed

+31
-50
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ build/pasta/xref-pasta.html
1010
*.exe
1111
test.py
1212
pasta.spec
13+
*.zip
14+
build/mouse_jiggle/mouse_jiggle.exe.manifest
15+
*.pkg
16+
*.pyz
17+
build/mouse_jiggle/warn-mouse_jiggle.txt
18+
build/mouse_jiggle/xref-mouse_jiggle.html
19+
*.spec

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| Version |
44
| - |
5-
| 0.1 |
5+
| 0.2 |
66

77
## Summary
88

mouse_jiggle.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Mouse Jiggle
2+
#
3+
# Author: Wes Moskal-Fitzpatrick
4+
#
5+
# Jiggle the mouse a little bit and prevent remote desktop logout.
6+
#
7+
8+
import pyautogui
9+
10+
while True:
11+
pyautogui.moveRel(5,0, duration=0)
12+
#pyautogui.moveRel(0,5, duration=0.25)
13+
pyautogui.PAUSE = 0.5
14+
pyautogui.moveRel(-5,0, duration=0)
15+
#pyautogui.moveRel(0,-5, duration=0.25)
16+
#pyautogui.click()
17+
pyautogui.press('shift')

pasta.py

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#
1212
# Change History
1313
# --------------
14-
# 2020-09-22 : 0.1 : WMF : Created. Ignore the comments.
14+
# 2020-09-22 : 0.1 : WMF : Created.
15+
# 2020-09-24 : 0.2 : WMF : Removed commented out test code.
1516
#
1617

1718
import tkinter
@@ -22,12 +23,10 @@
2223

2324
def countDown():
2425
'''start countdown seconds'''
25-
#clock.config(bg='yellow')
2626
for k in range(3, -1, -1):
2727
clock["text"] = k
2828
time.sleep(1)
2929
root.update() # Tk needs this after sleep()
30-
# clock.config(bg='red')
3130
clock["text"] = "Done"
3231

3332
root = tkinter.Tk()
@@ -39,36 +38,14 @@ def submitFunction():
3938
global clipboard
4039
button.place_forget()
4140
countDown()
41+
4242
# Click into window
4343
x, y = pyautogui.position()
4444
pyautogui.click(x, y)
45-
# Special Characters
46-
#clipboard = clipboard.replace("#", "\#")
47-
# Paste / Type
48-
49-
#print(clipboard)
50-
#pyautogui.typewrite(clipboard)
51-
#print(pyautogui._pyautogui_win.keyboardMapping['@'])
52-
#print()
53-
#pyautogui.platformModule.keyboardMapping['#'] = 478
54-
#print(pyautogui._pyautogui_win.keyboardMapping['~'])
55-
56-
#default_layout = win32api.GetKeyboardLayout()
57-
#print (default_layout)
58-
#print (hex(default_layout))
59-
60-
#win32api.LoadKeyboardLayout('00000409',1) # to switch to US english
61-
#print (win32api.GetKeyboardLayout())
62-
#win32api.LoadKeyboardLayout(default_layout,1) # switch back
63-
#print (win32api.GetKeyboardLayout())
64-
65-
#pyautogui.typewrite("###")
45+
46+
# "Paste"
6647
keyboard.write(clipboard)
6748
ready.set(1)
68-
#root.destroy()
69-
70-
# label_font = ('helvetica', 40)
71-
# clock = tkinter.Label(font=label_font)
7249

7350
clipboard = root.clipboard_get()
7451

@@ -81,24 +58,4 @@ def submitFunction():
8158
button = tkinter.Button(root, text="Ready", command=submitFunction)
8259
button.place(relx=.5, rely=.7, anchor="c")
8360

84-
root.wait_variable(ready)
85-
86-
# root.mainloop()
87-
88-
#--------
89-
90-
#B1 = tkinter.Button(root, text ="circle", cursor="circle")
91-
#B2 = tkinter.Button(root, text ="plus", cursor="plus")
92-
#B1.pack()
93-
#B2.pack()
94-
#root.mainloop()
95-
96-
#--------
97-
98-
#var = tkinter.IntVar()
99-
#button = tkinter.Button(root, text="Ready", command=lambda: var.set(1))
100-
#button.place(relx=.5, rely=.8, anchor="c")
101-
102-
#print("Ready to paste...")
103-
#button.wait_variable(var)
104-
#print("Paste Now.")
61+
root.wait_variable(ready)

0 commit comments

Comments
 (0)