Giter VIP home page Giter VIP logo

Comments (7)

kisdma avatar kisdma commented on June 10, 2024 1

Nice article - useful and easy to follow! Thank you very much!

from abdus.dev.

Tnx168 avatar Tnx168 commented on June 10, 2024

Thanks for your sharing, great project!
I intend to write some python script to get mem cache updated and check if have some keyword which pre-define will active telebot and send to bot to save.
I tried but don't know how to continue with your code to get the text content in your code, your code.
Other library is use time interval and paste content then check if changed. Seem it's different with yours solution is get update by OS event.

Below is using paperclip library, hope you cuold help me out with the same meaning by reuse your project. Thanks Abdus!

#coding:utf-8
import pyperclip
import datetime as dt
import time
import telebot

bot = telebot.TeleBot("Telebot_Token")

bot.send_message(chat_id, dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' Chào ngày mới', disable_notification = True)

#bot.send_photo(1838241701, photo = open('out.png', 'rb'))

lastContent = ''
while True:
clipboard_content = pyperclip.paste()
if clipboard_content:
if clipboard_content != lastContent:
print(clipboard_content)
lastContent = clipboard_content
if 'BGia' in clipboard_content or 'BG' in clipboard_content or 'XNĐH' in clipboard_content or 'XNDH' in clipboard_content:
bot.send_message(1838241701, clipboard_content, disable_notification = True)
time.sleep(10)

from abdus.dev.

Tnx168 avatar Tnx168 commented on June 10, 2024

Finally i did it Abdus, using your async workflow and dumpclip.exe. a little confuse when reading your code because too stupid to know where to get the clip content from your pure python code.

if name == "main":
async def main():
async for clip in monitor_clipboard():
print(clip)
# Insert check match keyword and use bot to send note content to Telegram chat

Many thanks Abdus!

from abdus.dev.

GordonAitchJay avatar GordonAitchJay commented on June 10, 2024

What is the benefit of this code:

        while th.is_alive():
            th.join(0.25)

As opposed to merely this:

            th.join()

Great post, btw! Thank you!

from abdus.dev.

abdusco avatar abdusco commented on June 10, 2024

@GordonAitchJay

The benefit of using while th.is_alive(): th.join(0.25) is that it allows the main thread to do other things while waiting for th to finish, without being blocked. If you just had th.join() the main thread wouldn't be able to throw KeyboardInterrupt when you hit Ctrl + C until the thread finished executing, for example.

from abdus.dev.

emielvanberlo avatar emielvanberlo commented on June 10, 2024

Hi, thanks for this code.

I used it to extend my Raspberry pi zero macro keyboard use case.

You have a password in a password manager but your remote server doesn't allow the use of CTRL+V
Thanks to you I transmit all clipboard changes to a key on my macro keyboard.
When I press the key the macro keyboard 'types' the password.

from abdus.dev.

abdusco avatar abdusco commented on June 10, 2024

@emielvanberlo Glad to be of help 🙏

from abdus.dev.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.