Please, add similar to GetCurrentDirectory() like
Getcurrentdrive()
it is true that you can go to it with coding but in this way it is much faster
Thank you
I apologize for posting this in the wrong section
Getcurrentdrive()
Re: Getcurrentdrive()
For Windows, it's as simple as this:
Code: Select all
Debug Left(GetCurrentDirectory(),2) ; Returns "C:"
Re: Getcurrentdrive()
Getcurrentdrive() = Left(GetCurrentDirectory(),2) ; Returns "C:"
for a single drive...and that's fine but ...
Getcurrentdrives() ?
i would like to detect all drivers are present, like
Getcurrentdrives() = Returns "C:" - Returns "D:" - Returns "F:"
for a single drive...and that's fine but ...
Getcurrentdrives() ?
i would like to detect all drivers are present, like
Getcurrentdrives() = Returns "C:" - Returns "D:" - Returns "F:"
Re: Getcurrentdrive()
Maybe something like this (Windows only):
Code: Select all
Enumeration
#DriveWindow
EndEnumeration
Enumeration
#DrivesList
EndEnumeration
Procedure.s GetDrives()
DriveName$=Space(#MAX_PATH)
OpenWindow(#DriveWindow, 10, 10, 232, 120, "Get Drives", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ListIconGadget(#DrivesList, 0, 0, WindowWidth(#DriveWindow), WindowHeight(#DriveWindow), "Drive", 64)
AddGadgetColumn(#DrivesList, 1, "Name", 128)
j=0
For i=65 To 90
Dir.s=Chr(i)+":\"
If FileSize(dir)=-2
GetVolumeInformation_(Dir,@DriveName$,255,0,0,0,0,255)
AddGadgetItem(#DrivesList, -1, Dir+Chr(10)+DriveName$)
AddKeyboardShortcut(#DriveWindow, i, i)
L=Len(DriveName$)
If L>LL
LL=L
EndIf
EndIf
Next
Repeat
Event=WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndProcedure
GetDrives()
Re: Getcurrentdrive()
The current drive can also be:
- UNC ( \\server\share)
- MTP (i.e smartphone connected by USB)
PS. To avoid confusion between GetCurrentDrive and GetCurrentDrives, ask (or code?) a function name like GetAvailableDrives()
- UNC ( \\server\share)
- MTP (i.e smartphone connected by USB)
PS. To avoid confusion between GetCurrentDrive and GetCurrentDrives, ask (or code?) a function name like GetAvailableDrives()
Re: Getcurrentdrive()
I have this in my Templates folder:
Code: Select all
For Drive = 'A' To 'Z' ; infratec Oct 2019
Dir = ExamineDirectory(#PB_Any, Chr(Drive) + ":/", "*")
If Dir
Debug Chr(Drive)
FinishDirectory(Dir)
EndIf
Next Drive
- It was too lonely at the top.
System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem