Python Forum
Select next file in directory and keep track of what's already been selected
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select next file in directory and keep track of what's already been selected
#3
(Feb-27-2019, 10:55 PM)nilamo Wrote: What does "select" mean, in this context?

I'd be surprised if you could do anything to the file upload dialog in a browser. That'd be a major security hole, and browsers don't normally leave too many of those open.

Select means... like the same way it'd look when you click on the file with the mouse.

Can we do it in normal windows explorer then, and have winautomation (auto mouse/keyboard contoller program) ctrl+drag it to the chrome UL window? That way it'd be automatically selected to upload, just won't be in the same folder which is fine.

if you run
pip install pyperclip
in cmd and then run the code I just built

import subprocess
import pyperclip #cross-platform clipboard module
path = pyperclip.paste() #grabs the clipboard & pastes it as variable "path"
extra = r'"' + path + '"' #combines extra code to get ready for subprocess module
subprocess.Popen('explorer /select, ' + extra)
print(extra)
then it'll grab the path from the clipboard & open an explorer window that'll auto select the file in the path. (this assumes the clipboard looks like D:\Documents\Downloads\AutomationTesting\2019-02-25\BE007-BAGedge 6 oz. Canvas Promo Tote-BLACK.jpg or similar.)

what i don't know is how to build on this to put the path in the clipboard, including the file name, and have it auto change to the next file every time.
Reply


Messages In This Thread
RE: Select next file in directory and keep track of what's already been selected - by loganpmgoa - Feb-27-2019, 11:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,402 Jun-27-2023, 01:17 PM
Last Post: diver999
  Extract file only (without a directory it is in) from ZIPIP tester_V 1 1,015 Jan-23-2023, 04:56 AM
Last Post: deanhystad
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,141 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  no such file or directory in SFTP saisankalpj 2 1,571 Nov-25-2022, 11:07 AM
Last Post: DeaD_EyE
Photo Making Zip file of a file and Directory Nasir 2 1,040 Oct-07-2022, 02:01 PM
Last Post: Nasir
  Failed to execute child process (No such file or directory) uriel 1 1,669 Sep-15-2022, 03:48 PM
Last Post: Gribouillis
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,685 Sep-12-2022, 04:50 AM
Last Post: python202209
  select files such as text file RolanRoll 2 1,182 Jun-25-2022, 08:07 PM
Last Post: RolanRoll
  importing functions from a separate python file in a separate directory Scordomaniac 3 1,389 May-17-2022, 07:49 AM
Last Post: Pedroski55
  How to read python shortcut target profile directory of Chrome Ink file sunny9495 1 1,675 Apr-12-2022, 06:12 PM
Last Post: sunny9495

Forum Jump:

User Panel Messages

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