para correr el programa solo necesitamos entrar a cp y ejecutar el archivo final.py
This is a Robotic Process Automation project with Python. The main goal, keep the download workspace free and organised automatically using a stack data structure and a stack sorting algotithm.
python3 -m venv .venv && source .venv/bin/activate
Please check this post .venv if you don't know how python virtual environments works.
Use the package manager pip to install foobar.
pip install -r requirements.txt
import pyautogui
# PyAutoGUI is a cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
import os
# This module provides a portable way of using operating system dependent functionality
os.getenv
# Return the value of the environment variable key as a string if it exists, or default if it doesn’t.
from os import listdir
# Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order, and does not include the special entries
print('Press Ctrl-C to quit.')
try:
while True:
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end='')
print('\b' * len(positionStr), end='', flush=True)
except KeyboardInterrupt:
print('\n')
All real projects use an .env variable with information that you would not be willing to have exposed, don't lag behind, but if this becomes a problem, hardcode the main.py.
BASE_PATH=/YOUR/PATH/TO/DOWNLOAD/STAGE
import os
from os import listdir
BASE_PATH = os.getenv('BASE_PATH')
print(BASE_PATH)
onlyfiles = [f for f in listdir(BASE_PATH)
if os.path.isfile(os.path.join(BASE_PATH, f))]
print(onlyfiles)
for i in onlyfiles:
print(i, os.path.getsize(BASE_PATH+'/'+i))
python main.py
/Users/jorgeabm/Downloads/buckets
['.DS_Store', 'f1.txt', 'f2.txt']
.DS_Store 6148
f1.txt 96775
f2.txt 12096
Pull requests or forks are welcome. If you feel noob to pull requests or forks, watch a youtube video or CTRL + C and CTRL + V the project and create a new project in github, don't let this limit you. Good luck from Jorge Blanquicett
Please make sure to update tests as appropriate.
utils
#para actualizar: py -m pip install --upgrade pip
#instalar: py -m ensurepip --upgrade
#ejecutar el archivo py get-pip.py de https://bootstrap.pypa.io/get-pip.py
#pip install virtualenv
#pip install pyautogui
#linux:python3 -m venv .venv && source .venv/bin/activate
#windows: py -m venv v && v\Scripts\activate.bat
#recomienda añadir al path C:\Users\Predator\AppData\Roaming\Python\Python311\Scripts
# print('Press Ctrl-C to quit.') #saber posición del mouse
# try:
# while True:
# x, y = pyautogui.position()
# positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
# print(positionStr, end='')
# print('\b' * len(positionStr), end='', flush=True)
# except KeyboardInterrupt:
# print('\n')
# BASE_PATH = os.getenv('BASE_PATH')
# print(BASE_PATH)
# onlyfiles = [f for f in listdir(BASE_PATH)
# if os.path.isfile(os.path.join(BASE_PATH, f))]
# print(onlyfiles)
# for i in onlyfiles:
# print(i, os.path.getsize(BASE_PATH+'/'+i))
# ruta = pathlib.Path('.')
# ruta = pathlib.cwd()
# ruta = os.getcwd()
#print(os.listdir())
#print(os.listdir('Dataset'))
#print(list(Path().iterdir()))
#print(list(Path('Dataset').iterdir()))
#print(os.path.join(os.getcwd(), 'Dataset'))
#print(PurePath.joinpath(Path.cwd(), 'Dataset'))
#os.mkdir('Dataset')
#Path('Dataset').mkdir(exist_ok=True)
#os.makedirs(os.path.join('Dataset', 'Scripts'))
PurePath.joinpath(Path.cwd(), 'Dataset2', 'Scripts2').mkdir(parents=True)
# imprimir extensiones de todos los archivos
# for archivo in ruta.iterdir():
# print(archivo.suffix)
# imprimir extensiones de archivos sin repetir
# extensiones = {archivo.suffix for archivo in ruta.iterdir()}
# print(f'extensiones: {extensiones}')
# diccionario = {k : [v for v in ruta.glob(f'*{k}')]
# for k in {archivo.suffix for archivo in ruta.iterdir()}}
# for extension, archivos in diccionario.items():
# carpeta = ruta / extension[1:]
# carpeta.mkdir()
# for archivo in archivos:
# archivo.replace(carpeta / archivo.name)
#cord_x, cord_y = pyautogui.position()
#print(str(cord_x)+";"+str(cord_y))
#pyautogui.moveTo(240, 351)
#pyautogui.click()
#pyautogui.doubleClick<()
#pyautogui.moveTo(469, 59)
#pyautogui.click()
#pyautogui.write('Texto que se escribe', interval=0.25)
#pyautogui.press('esc')
#pyautogui.press(['left', 'left', 'left'])
#pyautogui.keyUp('shift')
#pyautogui.hotkey('ctrl','c')
#pyautogui.alert('ALERTA')
#pyautogui. drag(10, 20, duration=0.3)
##10 Mover en dirección x (derecha)
##20 Mover en dirección y (abajo)
#pyautogui.moveTo(84,219)
#pyautogui.drag(200,0,duration=0.3)
#pyautogui.drag(0,200,duration=0.3)
#pyautogui.drag(-200,0,duration=0.3)
#pyautogui.drag(0,-200,duration=0.3)
#pyautogui.moveTo(84, 219)
#radio = 200
#diferencial = 2.5
#teta = 0
#while teta<math.pi:
#dteta = math.asin(diferencial/(2*radio))
#dx = diferencialmath.sin(2teta+dteta)
#dy = diferencialmath.cos(2teta+dteta)
#teta = teta+dteta
#pyautogui.drag(dx, -dy, duration=0)