Python Forum
Python Script Repeating Number When Saving Facebook Photos
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Script Repeating Number When Saving Facebook Photos
#1
Music 
Good afternoon.
I'm having an issue with my code where every time the fifth photo is being saved, it's named as number 4, causing a problem with saving since it's considered as a duplicate name. I've tried to fix it with the help of ChatGPT and Copilot, but the error persists.
The code:

import pyautogui import time import keyboard pyautogui.PAUSE = 0.2 def check_for_b(): return keyboard.is_pressed('b') time.sleep(4) numero_foto = 1 while True: pyautogui.rightClick(x=718, y=499) pyautogui.click(x=845, y=559) pyautogui.click(x=112, y=328) pyautogui.doubleClick(x=706, y=223) pyautogui.click(x=579, y=466) pyautogui.write(f"foto_{numero_foto}") pyautogui.press("enter") pyautogui.click(x=751, y=556) pyautogui.press("right") if not check_for_b(): numero_foto += 1 else: break

Attached Files

Thumbnail(s)
   
Reply
#2
My guess is some of these clicks are not clicking where you think they should. Is there a popup window that might be moving around?
Reply
#3
Mines does it on chrome. For example in download it saves all of the photos the same name. Allison.jpg, Allison(2).jpg, and Allison(3).jpg. I have to go in and rename it myself. I got this download extension on chrome from the internet. It's from Java. But it works like that.
Programs are like instructions or rules. Learning it gets us closer to a solution. Desired outcome. Computer talk.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to accept facebook cookies using python selenium? pablo86ad 0 2,041 Apr-06-2024, 09:19 PM
Last Post: pablo86ad
  Issues Scraping Facebook using facebook_scraper DustinKlent 4 6,732 Mar-19-2024, 08:17 PM
Last Post: Mostafa_heikal
  Why is 2/3 not just .666 repeating? DocFro 4 2,578 Dec-12-2023, 09:09 AM
Last Post: buran
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 10,055 Jun-29-2023, 11:57 AM
Last Post: gologica
  repeating a user_input astral_travel 17 6,708 Oct-26-2022, 04:15 PM
Last Post: astral_travel
  Rename multiple photos with DateTimeOriginal timestamp Stjude1982 2 3,210 Oct-21-2022, 12:24 AM
Last Post: Pedroski55
  Saving the times a script is run to a file or ... 3Pinter 7 4,220 Oct-19-2022, 05:38 PM
Last Post: 3Pinter
  Saving progress in a Python program to use later Led_Zeppelin 9 6,665 Sep-11-2022, 01:32 PM
Last Post: snippsat
  if else repeating Frankduc 12 5,916 Jul-14-2022, 12:40 PM
Last Post: Frankduc
  DELETE Post using Python FaceBook Graph API BIG_PESH 0 3,717 Mar-24-2022, 08:28 PM
Last Post: BIG_PESH

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.