kristo

DriveGetDrive not working as expected

14 posts in this topic

#1 ·  Posted

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



#2 ·  Posted (edited)

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

#4 ·  Posted

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

#5 ·  Posted (edited)

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted

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

#7 ·  Posted

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted

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

#9 ·  Posted

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#10 ·  Posted

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

#12 ·  Posted

Here you go...

screenshot_42.png


Cheap, Fast, Good - Choose any two

Share this post


Link to post
Share on other sites

#13 ·  Posted

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#14 ·  Posted

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

    • BBs19
      By BBs19
      Features:
      Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support for aerosnap etc. Many color schemes/themes included. See MetroThemes.au3 for more details. 3 type of Windows 8/10 style buttons. Modern checkboxes, radios, toggles and progressbar. All buttons, checkboxes etc. have hover effects! Windows 10 style modern MsgBox. Windows 10/Android style menu that slides in from left. Windows 10 style right click menu  
      Credits: @UEZ, for the function to create buttons with text using GDIPlus. @binhnx for his SSCtrlHover UDF
       
      Changelog:
      Download UDF with example:
       
       
    • keelaji
      By keelaji
      Hello,
      first of all i searched in the forum but i didn't found any solution to my problem.
      I am using windows 10.
      I made a script that is supposed to change the title to the active window, resize it to the smallest size possible (should be around 800 x 600) and move to (0, 0).
      I can change the title but i fail to do the other 2 tasks.
      i use wingettitle [active] copied from the F1 help tool (and this works), i i put the title in a variable and than i use
      winsettitle ($variable, "one") (this works too)
      winmove ("one", 0, 0, 800, 600) (doesn't do anything)
      i also tried
      local $x = winget ( "one")
      msgbox (0, "", $x) (i get a completely white box so i suppose winget can't have any data about my window ??)
      any suggestion ?
    • spuuunit
      By spuuunit
      I have a script that autostart with Windows, and sometimes some of my code is skipped. My script takes long pauses, so it's not that the script "goes too fast". This is my script for now:
      TraySetIcon("C:\Portables\AutoIt\_\icon.ico") AutoItSetOption("WinTitleMatchMode", 2) Run("C:\Portables\Key Manager\keymanager.exe") WinActivate("ATNSOFT Key Manager v") WinWaitActive("ATNSOFT Key Manager v") WinMove("ATNSOFT Key Manager v", "", 650, 200, 600, 800) Sleep(500) $pos = MouseGetPos() MouseClick("left", 1220, 210, 1, 100) MouseMove($pos[0], $pos[1], 100) Run("C:\Portables\foobar2000\foobar2000.exe") $version = 298 For $i = 0 To 99 Step 1 $path = "C:\Users\spunit\AppData\Local\Discord\app-0.0." & $version + $i & "\Discord.exe" If FileExists($path) Then Run($path) ExitLoop EndIf Next Run("C:\Portables\Firefox\FirefoxPortable.exe") Sleep(10000) WinMove("- Mozilla Firefox", "", 205, 0, 1214, 1047) Sleep(100) MouseClick("left", 1300, 15, 1, 10) Sleep(100) MouseClick("left", 1130, 275, 1, 10) Sleep(100) MouseClick("left", 930, 105, 1, 10) Sleep(100) Send("#{m}") Sometimes it skips to click and move mouse right after Key Manager starts. Almost always it skips everything after the last run.

      This type of script were never an issue with Windows 7... Any thoughts?
    • VIP
      By VIP
      I can not do anything with any user in the "Local Users Group"
      I tried from my account but I could not change my password (ie set new password)!
      But I was able to activate the Administrator account and I logged into the Administrator account and still could not do anything with my account! But I can set the password and disable the Administrator account from my account or Administrator.
      Any ideas? (Ignore the click on the Sign-in option in the Change Accout settings.)
       

    • dreivilo47
      By dreivilo47
      When I want to test Example 1 of Function _IECreate (AutoIt Help File), I see that function _IECreate doesn't work in Windows 10.
      Syntax Check (Ctrl+F5) gives no errors.
       
      Example 1:
      ; Create a browser window and navigate to a website #include <IE.au3> Local $oIE = _IECreate("www.autoitscript.com")  
      The error I receive with F5 (Tools, Go) in SciTE: