Why is this Python automation script not working? - python

I wrote a python script to automate content recordings in AdobePremiere Pro. It is supposed to be triggered by tasks created on Windows' Task Scheduler. But it is not working as intended.
It seems like the commands expected are not being sent for some reason.
This is the link to the repository containing all the logic tried to achieve the automation task:
https://github.com/rfabreu/AdobePremiere-Recording-Automation-Python
After writing the python scripts, the batch scripts were created to execute those python files.
Then on the Task Scheduler, tasks were created to run the required batch scripts.
Python script to start a recording:
import schedule
import time
from pynput import keyboard
def start_recording():
with keyboard.Press(keyboard.Key.g):
keyboard.press(keyboard.Key.g)
keyboard.release(keyboard.Key.g)
schedule.every().day.at("18:50").do(start_recording)
while True:
schedule.run_pending()
time.sleep(1)
Batch script to run the python scripts when triggered:
#echo off
cd [enter_dir_name]
set PYTHON_EXE=python
set SCRIPT_DIRECTORY=.
for %%f in (%SCRIPT_DIRECTORY%\*.py) do (
start /B /MIN %PYTHON_EXE% "%%f"
)
The expected result is that the script sends keyboard commands at a certain time:
So, considering that AdobePremiere Pro is open, the first script should send a key press command of the "g" key to start recording when triggered by the bat file.
Then, when triggered at a certain time another script should send the key press command of the "esc" key to stop recording.
The final step if for the third script to send a key press command of the "enter" key to save the recorded content.
After trying different things, including updating python on the pc, nothing happens.
When checking the Task Scheduler logs it seems like the task to run the bat file was executed successfully, but then the desired outcome did not reflect any effects on AdobePremiere Pro.

Related

task schedular for python file (.py)

I am trying to schedule a task in task scheduler I have created a batch file as below
"C:\ProgramData\Anaconda3\python.exe"
"C:\helloo\mail.py"
pause
the above is the content of my batch file. When I run the batch file I am able to get the output. I am not facing any issue with the code which I am executing. But with task scheduler I am following the below steps
1.open task scheduler
2.create task -- provided the name of the task and description
clicked on run whether the user is logged in or not and run with highest privileges
3.in triggers -->new --> onetime --ok
4.Action --> new--> action :start a program --
program script: where I kept my batch file.
5.cliked on finish
6. I am able to find the task in task scheduler but it is not showing as running
I need assistance in Actions tab
I have added the Action tab as below
1.in program i have mentioned PowerShell.exe
2. in next space i have mentioned -f " the file which you want to execute click on the file and click shift+right click and select copy as path "

running a python script from startup to shutdown

I am using python 3. On windows 7.
I recently made a python keylogger. It saves the keylogs in a text file as i type and upon pressing WIDOWS Key it sends the text from the textfile to my gmail account using smtplib.
I have to manually start the python file and it gets quite boring!
What my question is that is there any way to run that keylogger script on startup (without manually putting it in the startup folder -- because i want the script to do everything itself), and then to quickly close the script as soon as the user presses the shutdown button (and delay the shutdown time somehow).
The reason i want this is because i belive that a keylogger must be hidden from the user not to include that it must be hidden from the antivirus ;)
i have tested this with python task scheduler but it only takes time parameters (i.e. from 5:00 to 7:00) not the startup and shutdown time.
If i am to include more information on this topic that you need to solve this question i will gladly help you!
Thanks in advance

Scheduling some python tasks

I am trying to schedule some tasks using python...
Here is the whole project:
I have online classes on zoom which I want to automatically record. (I can't wake up on time). I have the invite link to the meeting. The time and date of the meeting are mentioned in it.
I have written the python script to extract the message. Let's call this script A.
I have also written a script to click on the link so that the zoom meeting opens. Let's call this script B.
I need to run the scripts in this order:
I manually run script A at let's say 12:00 AM in the night(morning). By that time, the teachers would have sent the invite link message.
Based on the information that was extracted, I want to automatically run script B and start the OBS recording. A way to end the recording after the meeting has ended would also be appreciated. (or I could just record for 1 hour).
I just need to find a way to automatically start recording from OBS screen recorder at the time mentioned in the message. (possibly in script B only)
How do I go about it?
You could use the windows task scheduler.
scriptA extracts the start time for the online task, sleeps until the correct time (using time.sleep()) and then uses subprocess.Popen to start script B at the appropriate time.
For example; simply starting script B, discarding any output (assuming it resides in the current working directory):
import subprocess
subprocess.Popen(
['python3', 'scriptB.py'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)

Execute script in background "from" Python 3 programmatically, on Ubuntu?

Is possible to launch a script in background FROM ANOTHER PYTHON SCRIPT?
I have one script: awesome.py .This must be executed every minute
But it must be launched from a UI python script (miniApp.py) on click button, this is the function:
def startScript(self,e)
//code to launch awesome.py script in background and repeat every minute
How can I do this?

How do I get Popen to wait for git-bash.exe to be ready for keyboard input?

I work on the voice coding platform Caster and I am trying to automate checking out a pull request here using git-bash.exe on Windows.
The relevant part of the file here is:
terminal = Popen(TERMINAL_PATH, cwd=local_directory)
# I'd like to replace this with a wait command
time.sleep(2)
Text(fetch_command).execute()
where TERMINAL_PATH = <git-bash-dir> and Text(fetch_command).execute() emulates keystrokes to put in a command fetching the pull request branch once the git bash window is ready.
Currently, it just waits 2 seconds hoping that the new window will be ready for input. How do I get python to wait until git-bash is ready for keyboard input?

Categories

Resources