Jump to content
kristo

DriveGetDrive not working as expected

Recommended Posts

kristo

The DriveGetDrive command returned all drives (option "ALL") for years now and my program could always rely on that function. Suddenly a drive letter that was created with the subst command does not appear in the list of drives anymore. And it clearly did, because I used to react to a certain subst command by reacting to new or revoked (subst /D) drive letters.

Why is that? I think this a bug because there's no way left to list ALL drive letters anymore.

And why should I use an API command for that when this was already built in for years?


 


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
Jos
9 minutes ago, kristo said:

Why is that? I think this a bug because there's no way left to list ALL drive letters anymore.

And why should I use an API command for that when this was already built in for years?

Could be me but it feels there are some assumptions in there and where does the API remark come from?

You claim it has been working for years and now it doesn't anymore, so my question to you would be: What have you changed? ;)

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kristo

Well I moved on to Windows 10. So that's probably it. No further assumptions made.

Try for yourself:

Point an empty drive letter to any folder with subst (for me this is subst T: c:\virtuals\drive_T)

if you check the array returned by DriveGetDrive("ALL") then you'll find not drive T: there. Any it was always there, otherwise a program that worked for many years now wouldn't have in the first place.

 

btw. No Drive command works for substituted letters anymore. You'll neither get a name nor a serial now.

Edited by kristo
Second thoughts

Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
kristo
15 minutes ago, kristo said:

This is interesting: The script starts working when I create an exe. The exe detects the virtual drive letter, while the au3 script doesn't :/

Now that doesn't seems right.

 


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
Jos

I've tested here a little with this script running it from SciTE (which is running under normal credentials):

Local $aArray = DriveGetDrive("ALL")
If @error Then
    ; An error occurred when retrieving the drives.
Else
    For $i = 1 To $aArray[0]
        ; Show all the drives found and convert the drive letter to uppercase.
        ConsoleWrite($aArray[$i] & @CRLF) ;### Debug Console
    Next
EndIf

Then open a CMD box and type: subst t: d:\temp

Run the script and this is the result:

--> Press Ctrl+Alt+END to Restart or Ctrl+Break -or- Ctrl+END to Stop
c:
d:
p:
t:
+>21:10:42 AutoIt3.exe ended.rc:0

Which seems fine to me. How are you testing when running it uncompiled?

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kristo

That's weird. If I do exactly the same here then I can't see T:

I'm running it simply from SCITE itself.


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
Jos

Here's a complete testscript that works for me ran from SciTE:

ShowMaps()
runwait(@ComSpec & " /c subst t: d:\temp")
ShowMaps()
runwait(@ComSpec & " /c subst t: /D")
ShowMaps()

Func ShowMaps()
    ConsoleWrite("---------" & @CRLF) ;### Debug Console
    Local $aArray = DriveGetDrive("ALL")
    If @error Then
        ; An error occurred when retrieving the drives.
    Else
        For $i = 1 To $aArray[0]
            ; Show all the drives found and convert the drive letter to uppercase.
            ConsoleWrite($aArray[$i] & @CRLF) ;### Debug Console
        Next
    EndIf
EndFunc   ;==>ShowMaps

result:

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Development\AutoIt3\programs\test\test1.au3"    
--> Press Ctrl+Alt+END to Restart or Ctrl+Break -or- Ctrl+END to Stop
---------
c:
d:
p:
---------
c:
d:
p:
t:
---------
c:
d:
p:
+>21:37:59 AutoIt3.exe ended.rc:0

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kristo

Here's what the script returns for me:

 

---------
c:
i:
u:
x:
---------
c:
i:
u:
x:
---------
c:
i:
u:
x:

 

 


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
Jos

I have no idea why that would be and I am running: OS:WIN_10/  CPU:X64 OS:X64 
Which version of AutoIt3 are you running and are you running with SciTE4AutoIt3 full , in other words: is the script shelled by AutoIt3Wrapper?? 

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kristo

Yes it is.

And as soon as I compile the script into an executable it returns the correct result. But not from within SCITE (and I just updated AutoIt and Scite to the latest stable build btw.)


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
kristo

Here you go...

screenshot_42.png


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites
Jos

Your setup is identical to mine. (Sorry for asking but) You do have a d:\temp directory ...right?
Other than that: I am out of ideas at the moment.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
kristo

Yes I do.

Well at least I know that it works after compiling. But it's strange anyway.


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Dreamfire
      By Dreamfire
      Hi,
      Since today, exe's are being flagged as having a trojan by Windows Defender (Fuery.B!cl)
      Version:  3.3.14.3 - SciTE Version 3.7.3



       

    • PramodR
      By PramodR
      Hello,
      I have to execute below block of code in elevated previllage, as that particular wmic class will work only with admin previlage.
      i am getting out put when i launch autoit as administrator,  but i will not be able to launch autoit as admin in this particular case but my user have admin rights.
      is there any better way i can run those command as administrator.?
      tried below steps:
      i have tried #RequireAdmin but that creates a user prompt  Tried using Runas command but gives error as wrong username or password , stuck with that step.  
       
    • dwaynek
      By dwaynek
      traytip isn't working in windows 10. nothing happens when i use the Traytip command.
      here's a simple script i used:
      TrayTip("I'm a title", "I'm the message", 5) i tried changing the registry setting HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced ( which didn't have EnableBalloonTips) and creating a DWORD entry called EnableBalloonTips and setting it to 1 and logging off then back in. that did not resolve the problem.
      i'm running Windows 10 v1709 b16299.431
    • antonioj84
      By antonioj84
      Hi all to the forum guru and expert I am trying to  automate this. in the registry  I have the network profile name network 2 and network   I want to  change their  CATEGORY  to Private .  Can someone lead me in the right direction.
      Private is 1 and Public is 0
      #RequireAdmin Global $sHKLMRoot = @OSArch = "x64" ? "HKLM64" : "HKLM" RegWrite($sHKLMRoot &"\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\NewNetworks" ,'/v NetworkList /t REG_MULTI_SZ /d 00000000 /f') see  attached picture below
      Much appreaciate
       

    • PhoenixPRO
      By PhoenixPRO
      When I try to automate this install program I can not get any of the buttons to click with the "ControlClick" function or any mouse movement to move the mouse to the and click it.  My OS is Windows 10 64Bit.  I have tried both 32bit and 64bit installs of Autoit V3 to no avail.
      I could not even get the run command to start the program until I used the variation of the command below in the script.
      With the script below the install program starts but will not click the "Next" button no matter what I do.
      Any help will be greatly appreciated.
      Thanks in advance.
       
      #include <MsgBoxConstants.au3>
      Opt("MouseCoordMode", 0) ;1=absolute, 0=relative to active window, 2=client
      Local $Success
      Run(@ComSpec & " /c " & 'C:\PhoenixPro_Install\RDXUtil\RDX_Tools_setup.exe', "C:\PhoenixPro_Install\RDXUtil", @SW_HIDE )

      WinWait("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      WinActivate("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62")
      ControlClick ("RDX Tools 1.62 - InstallShield Wizard", "Welcome to the InstallShield Wizard for RDX Tools 1.62", 1639, "left", 1) ;Next Button
×