Skip to content

Commit

Permalink
0.2
Browse files Browse the repository at this point in the history
Added a little mouse jiggler to prevent remote logoff.
  • Loading branch information
codefitz committed Sep 29, 2020
1 parent 1d73b35 commit 014f22e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 50 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ build/pasta/xref-pasta.html
*.exe
test.py
pasta.spec
*.zip
build/mouse_jiggle/mouse_jiggle.exe.manifest
*.pkg
*.pyz
build/mouse_jiggle/warn-mouse_jiggle.txt
build/mouse_jiggle/xref-mouse_jiggle.html
*.spec
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Version |
| - |
| 0.1 |
| 0.2 |

## Summary

Expand Down
17 changes: 17 additions & 0 deletions mouse_jiggle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Mouse Jiggle
#
# Author: Wes Moskal-Fitzpatrick
#
# Jiggle the mouse a little bit and prevent remote desktop logout.
#

import pyautogui

while True:
pyautogui.moveRel(5,0, duration=0)
#pyautogui.moveRel(0,5, duration=0.25)
pyautogui.PAUSE = 0.5
pyautogui.moveRel(-5,0, duration=0)
#pyautogui.moveRel(0,-5, duration=0.25)
#pyautogui.click()
pyautogui.press('shift')
55 changes: 6 additions & 49 deletions pasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
#
# Change History
# --------------
# 2020-09-22 : 0.1 : WMF : Created. Ignore the comments.
# 2020-09-22 : 0.1 : WMF : Created.
# 2020-09-24 : 0.2 : WMF : Removed commented out test code.
#

import tkinter
Expand All @@ -22,12 +23,10 @@

def countDown():
'''start countdown seconds'''
#clock.config(bg='yellow')
for k in range(3, -1, -1):
clock["text"] = k
time.sleep(1)
root.update() # Tk needs this after sleep()
# clock.config(bg='red')
clock["text"] = "Done"

root = tkinter.Tk()
Expand All @@ -39,36 +38,14 @@ def submitFunction():
global clipboard
button.place_forget()
countDown()

# Click into window
x, y = pyautogui.position()
pyautogui.click(x, y)
# Special Characters
#clipboard = clipboard.replace("#", "\#")
# Paste / Type

#print(clipboard)
#pyautogui.typewrite(clipboard)
#print(pyautogui._pyautogui_win.keyboardMapping['@'])
#print()
#pyautogui.platformModule.keyboardMapping['#'] = 478
#print(pyautogui._pyautogui_win.keyboardMapping['~'])

#default_layout = win32api.GetKeyboardLayout()
#print (default_layout)
#print (hex(default_layout))

#win32api.LoadKeyboardLayout('00000409',1) # to switch to US english
#print (win32api.GetKeyboardLayout())
#win32api.LoadKeyboardLayout(default_layout,1) # switch back
#print (win32api.GetKeyboardLayout())

#pyautogui.typewrite("###")

# "Paste"
keyboard.write(clipboard)
ready.set(1)
#root.destroy()

# label_font = ('helvetica', 40)
# clock = tkinter.Label(font=label_font)

clipboard = root.clipboard_get()

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

root.wait_variable(ready)

# root.mainloop()

#--------

#B1 = tkinter.Button(root, text ="circle", cursor="circle")
#B2 = tkinter.Button(root, text ="plus", cursor="plus")
#B1.pack()
#B2.pack()
#root.mainloop()

#--------

#var = tkinter.IntVar()
#button = tkinter.Button(root, text="Ready", command=lambda: var.set(1))
#button.place(relx=.5, rely=.8, anchor="c")

#print("Ready to paste...")
#button.wait_variable(var)
#print("Paste Now.")
root.wait_variable(ready)

0 comments on commit 014f22e

Please sign in to comment.