Need idea on setting a directory in the File Explorer

Just starting out? Need help? Post your questions and find answers here.
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Need idea on setting a directory in the File Explorer

Post by TerryHough »

Here is a code snippet

Code: Select all

URL$ = "https://filencdor.ondemand.sas.com/eNC3Web/"
SetCurrentDirectory("C:\SomeDir\SubDir\")
RP.l = RunProgram(URL$,"", GetCurrentDirectory(), #PB_Program_Open)
If RP
  WaitProgram(RP)
  CloseProgram(RP)
EndIf
End
This accesses a webpage that is designed to select and have files uploaded it to it. If you access that page, click on the Test Format button at the bottom.

This opens a local explorer window, but it ALWAYS opens on the last local directory that was opened on a previous access.

I want to be able to set the directory to be accessed before accessing the webpage, but I cannot seem to find a way to do so.

Ideas appreciated.

Terry
Rinzwind
Enthusiast
Enthusiast
Posts: 638
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Need idea on setting a directory in the File Explorer

Post by Rinzwind »

You can't since it is the browser which decides what to show. Even a website can't demand what is the start directory. I guess most use the last chosen location.
BarryG
Addict
Addict
Posts: 3318
Joined: Thu Apr 18, 2019 8:17 am

Re: Need idea on setting a directory in the File Explorer

Post by BarryG »

Albert90 wrote: Thu Jan 13, 2022 7:28 amThis is just a simple code example of how to create a directory in the file explorer using C#
You know this is a BASIC forum, right? I don't understand any of your posts, especially the "what's the best vacuum cleaner" one. I'm hedging my bets that you're a spammer and/or bot, because nothing you've posted so far has had any relevance to PureBasic at all. Your replies seem to be based on trigger text of preceding posts.
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Need idea on setting a directory in the File Explorer

Post by #NULL »

I also wonder if AI-Bert is human (the avatar also looks similar to those AI generated faces).
User avatar
ChrisR
Addict
Addict
Posts: 1150
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: Need idea on setting a directory in the File Explorer

Post by ChrisR »

You can open the explorer on a specified folder using /e,[Path]

Code: Select all

;OpenDir$ = "/e,C:\SomeDir\SubDir\"
OpenDir$ = "/e," + GetTemporaryDirectory()
ShellExecute_(#Null, @"Open", @"explorer.exe", @OpenDir$, @"", #SW_NORMAL)
Post Reply