Python Forum
Beginner needs help with code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner needs help with code
#1
Hello, I am a newbie to the world of coding and python at the age of 13, I have a kali machine and I have been messing around with the Lazy Script. I decided I wanted to make it more automated, so i have been messing around and learning about python and i made this script to start automating what i wana do.

#!/root/
       #Imports 
       import time
       from pynput.keyboard import Key, Controller
       import subprocess
       from subprocess import call
       #Defines the key controller as keyboard
       keyboard = Controller()
       #opens the lazy script
       subprocess.call('l')
       time.sleep(1)
       keyboard.press('9')
       time.sleep(1)
       keyboard.release('9')
I am able to open the lazy script program, but to get to the next menu you have to type 9 and press enter. i tried different things like simulating keys but it didn't work. Anyone have any suggestions? I feel like there is a simpler way than simulating keys but i don't know it. Thank you for taking your time to read this thread Dance
Reply
#2
You can perhaps try
process = subprocess.Popen(['l'], stdin=supbrocess.PIPE)
process.stdin.write('9\n')
process.wait()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner: Code not work when longer list raiviscoding 2 765 May-19-2023, 11:19 AM
Last Post: deanhystad
  Code not reading http link from .txt file (Beginner level) plarrip 3 2,353 Dec-17-2020, 11:33 PM
Last Post: bowlofred
  Beginner: I need help understanding few lines of a code. hop_090 1 1,642 Sep-07-2020, 04:02 PM
Last Post: Larz60+
  Beginner Code, how to print something after a number of turns (guessing game) QTPi 4 2,682 Jun-18-2020, 04:59 PM
Last Post: QTPi
  A beginner code... TheDude 7 3,217 Jun-18-2020, 05:39 AM
Last Post: TheDude
  [Beginner] Code is not producing desired result fakej171 2 2,380 Mar-21-2020, 10:26 AM
Last Post: buran
  what function should i use to tidy up my code (extreme beginner) scraig0117 4 2,255 Dec-16-2019, 04:03 PM
Last Post: scraig0117
  Beginner at Python. Trying to count certain integer from random string of code kiaspelleditwrong 3 2,367 Oct-14-2019, 10:40 AM
Last Post: perfringo
  Beginner trying to code in python RA0211 1 1,816 Sep-26-2019, 11:10 AM
Last Post: emryscass
  Beginner Code bh3282 9 4,461 Mar-18-2019, 03:58 PM
Last Post: samsonite

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020