DriveGetType funktioniert unter WinXP, aber nicht unter Win7

  • Hallo Zusammen,

    ich habe ein Installationsscript geschrieben, bei dem geprüft wird, ob das Installationsverzeichnis vom Typ "Netzlaufwerk" ist.
    Das funktioniert unter WinXP sehr gut, aber beim testen auf einer Win7 Umgebung ist der Rückgabewert für DriveGetType "".
    Hat jemand eine Idee woran das liegen kann?

    Danke :)

    • Offizieller Beitrag

    Typ "Netzlaufwerk" ist


    Wie wär es mit Hilfe lesen?
    Der Typ ist nicht "Netzlaufwerk" sondern "NETWORK"! Und damit klappt es unter Win7 genauso, wie unter XP.

    [autoit]

    $a = DriveGetDrive("NETWORK")
    For $i = 1 To $a[0]
    ConsoleWrite($a[$i] & @CRLF)
    ConsoleWrite(DriveGetType($a[$i]) & @CRLF)
    Next

    [/autoit]
  • Das gilt übrigends allgemein in Win7...Pfade die bei der Windows-Installation erstellt wurden müssen immer in der Englischen Version geschrieben werden (das kann man übrigends auch sehen, wenn man sich mal die Mühe macht und oben in der Pfadleiste mal reinklickt, dann verschwinden nähmlich die Deutschen Ordnerbezeichnungen und alle Ordner die von Windows erstellt wurden stehen in Englisch da...)anders ist es bei selbst oder von anderen Programmen erstellten Dateipfaden

    Bild1: Ich beim debuggen

  • Hallo Zusammen,

    erstmal Danke für die schnelle Antwort, aber....


    Das ist mein Script:

    Spoiler anzeigen
    [autoit]

    $NetWorkPath_System = StringMid($NetWorkPath_System, 1, StringInStr($NetWorkPath_System, "\", 0, -1) -1)

    [/autoit] [autoit][/autoit] [autoit]

    $var = DriveStatus( $NetWorkPath_System )
    MsgBox(4096,"Status",$var)
    $var = DriveGetType( $NetWorkPath_System )
    MsgBox(4096, "Drive type:", $var & " Lentgh = " & StringLen($var))

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "Laufwerk verbunden mit", DriveMapGet(StringMid($NetWorkPath_System, 1, 2 )) & " Lentgh = " & StringLen($var))

    [/autoit] [autoit][/autoit] [autoit]

    Select
    Case DriveGetType($NetWorkPath_System) = "FIXED"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is local harddisk '" & StringMid($NetWorkPath_System, 1, 3 ) & "'")
    $MsgBox_result = MsgBox(292, "Disk drive for Shimadzu LCSolution", "Continue with installation on local harddisk '" & StringMid($NetWorkPath_System, 1, 3 ) & "'?")
    If $MsgBox_result = 7 Then
    ; - 'No' replied
    Exit
    EndIf
    Case DriveGetType($NetWorkPath_System) = "Unknown"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is unknown '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "Removable"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is removable '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "Network"
    MsgBox(4096, "Disk drive for Shimadzu LCSolution", "Path is network '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "CDROM"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is CDROM '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "RAMDisk"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is RAMDisk '" & $NetWorkPath_System & "'")
    Case Else
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "No valid disk drive selected '" & $NetWorkPath_System & "', installation will be terminated")
    Exit
    EndSelect

    [/autoit]

    Unter WinXP erhalte ich die Meldungen
    - "READY"
    - "Network Lentgh = 7"
    - korrekten Serverpfad
    - "Path is network" und den genauen Netzwerkpfad

    Unter Win7
    - "INVALID"
    - " Lentgh =0
    - " Lentgh =0
    - ""No valid disk drive selected '" und trotzdem den genauen Netzwerkpfad.

    Irgendwelche Ideen?

    Danke
    RoWi


    Edit BugFix: Spoiler- und AutoIt- Tags gesetzt (Bitte in Zukunft selber machen)

    2 Mal editiert, zuletzt von BugFix (17. Oktober 2011 um 12:33)

  • Das sieh mir aber sehr nach einem Codefetzen aus. Was zum Beispiel soll das werden:

    [autoit]

    $NetWorkPath_System = StringMid($NetWorkPath_System, 1, StringInStr($NetWorkPath_System, "\", 0, -1) -1)

    [/autoit]

    Also du nimmst einen Teil einer Variable die nicht existiert und weist diesen Wert dieser Variable zu ö.Ö ich denke du hast noch mehr code und den bräuchten wir schon auch noch. Und bevor ich es vergesse, setze doch bitte Kommentare zu deinem Code...erleichtert auch dir die Arbeit, wenn du später noch etwas am Code ändern willst.

    Bild1: Ich beim debuggen

  • Hallo General Kaboom,

    es wird ein String ("L:\LabSolution\MEX_LERMA\LCSolution\!System\SysAdmin05.mdb") aus der Registry ausgelesen und der Variablen '$NetWorkPath_System' zugewiesen.
    Durch die Zeile
    $NetWorkPath_System = StringMid($NetWorkPath_System, 1, StringInStr($NetWorkPath_System, "\", 0, -1) -1)
    wird der String auf den Wert "L:\LabSolution\MEX_LERMA\LCSolution\!System" gekürzt.
    Hieraus soll nun ermittelt werden, ob es sich um ein 'Network' Pfad handelt oder eben nicht.
    Wie gesagt, funktioniert es unter WinXP hervorragend, aber unter Win7 nicht.


    Spoiler anzeigen


    #comments-start
    ----------------------------------------------------

    Installation script for BHC-Launcher
    RoWi, 2011-10-17

    ----------------------------------------------------
    #comments-end

    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <ButtonConstants.au3>
    #include <ProgressConstants.au3>

    #RequireAdmin

    Dim $Paper_A4 = 0
    Dim $Paper_Letter = 0
    Dim $progressbar1

    $OS_System = @OSVersion

    $NetWorkPath_System = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "SystemResourceFile")

    If StringLen($NetWorkPath_System) = 0 Then
    MsgBox(16, "Shimadzu LabSolution", "LCSolution not installed, please install LCSolution first")
    Exit
    EndIf

    $NetWorkPath_System = StringMid($NetWorkPath_System, 1, StringInStr($NetWorkPath_System, "\", 0, -1) -1)

    ;------------------------------------------
    ;-- Only for test in WinXP and Win7
    $var = DriveStatus( $NetWorkPath_System )
    MsgBox(4096,"Status",$var)
    $var = DriveGetType( $NetWorkPath_System )
    MsgBox(4096, "Drive type:", $var & " Length = " & StringLen($var))

    MsgBox(0, "Drive mapped with ", DriveMapGet(StringMid($NetWorkPath_System, 1, 2 )) & " Length = " & StringLen($var))

    ;-- Check for drive type
    ;-- Installation only valid on network drive or local harddisk
    Select
    Case DriveGetType($NetWorkPath_System) = "FIXED"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is local harddisk '" & StringMid($NetWorkPath_System, 1, 3 ) & "'")
    $MsgBox_result = MsgBox(292, "Disk drive for Shimadzu LCSolution", "Continue with installation on local harddisk '" & StringMid($NetWorkPath_System, 1, 3 ) & "'?")
    If $MsgBox_result = 7 Then
    ; - 'No' replied
    Exit
    EndIf
    Case DriveGetType($NetWorkPath_System) = "Unknown"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is unknown '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "Removable"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is removable '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "Network"
    MsgBox(4096, "Disk drive for Shimadzu LCSolution", "Path is network '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "CDROM"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is CDROM '" & $NetWorkPath_System & "'")
    Case DriveGetType($NetWorkPath_System) = "RAMDisk"
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "Path is RAMDisk '" & $NetWorkPath_System & "'")
    Case Else
    MsgBox(16, "Disk drive for Shimadzu LCSolution", "No valid disk drive selected '" & $NetWorkPath_System & "', installation will be terminated")
    Exit
    EndSelect

    ;--Assign path
    $NetWorkPath_Root = StringMid($NetWorkPath_System, 1, StringInStr($NetWorkPath_System, "\!", 0, -1) -1)

    $NetWorkPath_Log = $NetWorkPath_Root & "\!Log"

    $NetWorkPath_Method = $NetWorkPath_Root & "\!Method"

    $NetWorkPath_Template = $NetWorkPath_Root & "\!Template"

    $LCSol_RoutPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\Path", "Prog Path")
    $LCSol_RoutPath = StringMid($LCSol_RoutPath, 1, StringInStr($LCSol_RoutPath, "\", 0, -1) -1)

    $LCSol_SysPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\Path", "Sys Path")

    $LCSol_ProgPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\Path", "Prog Path")

    ;-- Call form
    myBHC_GUI()

    ;----------------------------------------------------
    ;--Links within Start Menu and Desktop
    DirRemove(@StartMenuCommonDir & "\Shimadzu", 1)

    DirCreate(@StartMenuCommonDir & "\Shimadzu")

    DirCopy (@ScriptDir & "\Shimadzu", @StartMenuCommonDir& "\Shimadzu", 1)

    FileDelete(@DesktopCommonDir & "\BHC-Launcher.LNK")

    FileCopy (@ScriptDir & "\BHC-Launcher.LNK", @DesktopCommonDir, 1)

    GUICtrlSetData($progressbar1, 10)
    ;----------------------------------------------------
    ;--\!Log
    If Not FileExists($NetWorkPath_Log) Then
    DirCreate($NetWorkPath_Log)
    EndIf

    $Target_Path = $NetWorkPath_Root & "\!Log\"
    $Source_Path = @ScriptDir & "\!Log\"
    myBHC_FileDate($Target_Path, $Source_Path, "LogBHCViewer2003.mde")
    GUICtrlSetData($progressbar1, 20)
    ;----------------------------------------------------
    ;--\!Method
    If Not FileExists($NetWorkPath_Method) Then
    DirCreate($NetWorkPath_Method)
    EndIf

    $Target_Path = $NetWorkPath_Root & "\!Method\"
    $Source_Path = @ScriptDir & "\!Method\"
    myBHC_FileDate($Target_Path, $Source_Path, "MethProp - QCTool.txt")
    GUICtrlSetData($progressbar1, 30)
    ;----------------------------------------------------
    ;--\!System
    $Target_Path = $NetWorkPath_System & "\"
    $Source_Path = @ScriptDir & "\!System\"
    myBHC_FileDate($Target_Path, $Source_Path, "PKZIPC.EXE")
    myBHC_FileDate($Target_Path, $Source_Path, "DEFAULT.CFG")
    myBHC_FileDate($Target_Path, $Source_Path, "LabSolution_Viewer2003_DB.mde")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC1_all_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC2_all_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC3_all_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC4_all_Close.exe")
    GUICtrlSetData($progressbar1, 40)
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC1_Real_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC2_Real_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC3_Real_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC4_Real_Close.exe")
    myBHC_FileDate($Target_Path, $Source_Path, "AutoIt_LC_all_Close.exe")
    GUICtrlSetData($progressbar1, 50)
    ;----------------------------------------------------
    ;--\!Templates -- Report Templates
    If Not FileExists($NetWorkPath_Template) Then
    DirCreate($NetWorkPath_Template)
    EndIf

    If $Paper_A4 = 1 Then
    $Source_Path = @ScriptDir & "\!Template\A4\"
    ElseIf $Paper_Letter = 1 Then
    $Source_Path = @ScriptDir & "\!Template\Letter\"
    EndIf

    $Target_Path = $NetWorkPath_Template & "\"
    $myBHC_FileType = "*.LCR"
    myBHC_DirectoryRead($Target_Path, $Source_Path, $myBHC_FileType)

    ;--\!Templates -- Batch File Templates
    $Source_Path = @ScriptDir & "\!Template\"
    $Target_Path = $NetWorkPath_Template & "\"
    $myBHC_FileType = "*.TLB"
    myBHC_DirectoryRead($Target_Path, $Source_Path, $myBHC_FileType)

    ;--\!Templates -- Method Templates
    $Source_Path = @ScriptDir & "\!Template\"
    $Target_Path = $NetWorkPath_Template & "\"
    $myBHC_FileType = "*.TLM"
    myBHC_DirectoryRead($Target_Path, $Source_Path, $myBHC_FileType)
    GUICtrlSetData($progressbar1, 60)
    ;----------------------------------------------------
    ; -- BHC-Launcher
    $Target_Path = $LCSol_RoutPath
    $Source_Path = @ScriptDir & "\"
    myBHC_FileDate($Target_Path, $Source_Path, "LabSolution-Viewer2003.mde")
    myBHC_FileDate($Target_Path, $Source_Path, "SHIMADZU - How to use BHC Launcher.pdf")
    GUICtrlSetData($progressbar1, 70)
    ;----------------------------------------------------
    ; Batch File Reort template
    $search = FileFindFirstFile($LCSol_SysPath & "\*")

    ; Check, if search has been successful
    If $search = -1 Then
    MsgBox(0, "Error", "No matching files found for selected pattern")
    Exit
    EndIf

    While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    $attrib = FileGetAttrib($LCSol_SysPath & "\" & $file)
    If $attrib = "D" THEN DirRemove($LCSol_SysPath & "\" & $file, 1)
    WEnd

    ; Close handle for search
    FileClose($search)

    FileCopy ($NetWorkPath_Template & "\Batch File Report.lcr", $LCSol_SysPath & "\", 1)
    GUICtrlSetData($progressbar1, 80)
    ;----------------------------------------------------
    ; new Library
    FileCopy (@ScriptDir & "LSSSystemUtility.dll", $LCSol_ProgPath & "\", 1)
    Run ("regsvr32" & $LCSol_ProgPath & "\LSSSystemUtility.dll")
    ;----------------------------------------------------
    ; Registry entries for LabSolution LCSolution
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "IsNetworkValid", "REG_SZ", "Yes")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "IsUsingOleFile", "REG_SZ", "No")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "SysAdminDBBackup", "REG_DWORD", "00000001")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "UserPropertyOnlyEachUser", "REG_DWORD", "00000001")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\Common\SystemAdmin", "UserPropertyReadOnly", "REG_DWORD", "00000001")

    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\SystemFile", "SystemConfigFile1", "REG_SZ", "")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\SystemFile", "SystemConfigFile2", "REG_SZ", "")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\SystemFile", "SystemConfigFile3", "REG_SZ", "")
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\SystemFile", "SystemConfigFile4", "REG_SZ", "")

    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\SHIMADZU\LabSolutions\LCsolution\CurrentVersion\QC-ASSIST", "Support", "REG_DWORD", "00000001")
    GUICtrlSetData($progressbar1, 90)
    ShellExecute("LabSolution-TransferDB.mde", "", @ScriptDir, "", @SW_HIDE)
    ShellExecuteWait("LabSolution-TransferDB.mde", "", @ScriptDir, "", @SW_HIDE)
    GUICtrlSetData($progressbar1, 100)
    MsgBox(0, "BHC-Installation", "Installation has been completed")


    Exit
    ;----------------------------------------------------
    Func myBHC_FileDate(ByRef $Target_Path, ByRef $Source_Path, ByRef $myBHC_FileName)


    If Not FileExists($Source_Path & $myBHC_FileName) Then
    MsgBox(16,"File copy: source file is missing","Source path./ file name: " & $Target_Path & $myBHC_FileName & @CRLF & "Installation will be terminated")
    Exit
    EndIf

    If Not FileExists($Target_Path & $myBHC_FileName) Then
    FileCopy ($Source_Path & $myBHC_FileName, $Target_Path, 1)
    Else
    ;Target
    $t = FileGetTime($Target_Path & $myBHC_FileName, 1)
    $Target_DateCreated = $t[0] & $t[1] & $t[2]
    $t = FileGetTime($Target_Path & $myBHC_FileName, 0)
    $Target_DateModified = $t[0] & $t[1] & $t[2]
    ;Source
    $t = FileGetTime($Source_Path & $myBHC_FileName, 1)
    $Source_DateCreated = $t[0] & $t[1] & $t[2]
    $t = FileGetTime($Source_Path & $myBHC_FileName, 0)
    $Source_DateModified = $t[0] & $t[1] & $t[2]

    If Not ($Target_DateCreated = $Source_DateCreated) And ($Target_DateModified >= $Source_DateModified) Then
    FileCopy ($Source_Path & $myBHC_FileName, $Target_Path, 1)
    EndIf
    EndIf

    EndFunc
    ;----------------------------------------------------
    Func myBHC_DirectoryRead(ByRef $Target_Path, ByRef $Source_Path, ByRef $myBHC_FileType)

    $search = FileFindFirstFile($Source_Path & $myBHC_FileType)

    ; Prüfen, ob die Suche erfolgreich war
    If $search = -1 Then
    MsgBox(0, "Error", "No matching files found for selected pattern (" & $myBHC_FileType & ")")
    Exit
    EndIf

    While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    myBHC_FileDate($Target_Path, $Source_Path, $file)
    WEnd

    ; Handle für Suche schliessen
    FileClose($search)

    EndFunc
    ;----------------------------------------------------
    Func myBHC_GUI()
    Local $widthCell, $msg, $iOldOpt, $GreenYellow, $Aqua, $Yellow

    $widthCell = 80
    $iH = 10
    $lf = 20
    ; GUI
    $GreenYellow = 0xADFF2F
    $Aqua = 0x00FFFF
    $Yellow = 0xFFFF00
    $OrangeRed = 0xFF4500
    $SpringGreen = 0x00FF7F
    $Khaki = 0xF0E68C

    GuiCreate(" BHC-Installation", 600, 400)
    GUICtrlCreateLabel("Operation system: " , 10, $iH + $lf * 1, 130) ; Erste Zelle, Breite 80
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel("PC name: ", 10, $iH + $lf * 2, 130)
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel("Domain", 10, $iH + $lf * 3, 130)
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel("Shimadzu LCSolution: ", 10, $iH + $lf * 5, 130)
    GuiCtrlSetBkColor(-1, $Aqua)
    GUICtrlCreateLabel("Program installation path: ", 10, $iH + $lf * 6)
    GuiCtrlSetBkColor(-1, $Aqua)
    GUICtrlCreateLabel("Data storage path: ", 10, $iH + $lf * 8, 130)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel("..\!System: ", 50, $iH + $lf * 9, 90)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel("..\!Log: ", 50, $iH + $lf * 10, 90)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel("..\!Method: ", 50, $iH + $lf * 11, 90)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel("..\!Template: ", 50, $iH + $lf * 12, 90)
    GuiCtrlSetBkColor(-1, $Yellow)

    GUICtrlCreateLabel(@OSVersion , 160, $iH + $lf * 1, 200) ; Erste Zelle, Breite 80
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel(@ComputerName, 160, $iH + $lf * 2, 200)
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel(@LogonDNSDomain, 160, $iH + $lf * 3, 200)
    GuiCtrlSetBkColor(-1, $GreenYellow)
    GUICtrlCreateLabel($LCSol_RoutPath, 160, $iH + $lf * 5, 300)
    GuiCtrlSetBkColor(-1, $Aqua)
    GUICtrlCreateLabel($LCSol_ProgPath, 160, $iH + $lf * 6, 300)
    GuiCtrlSetBkColor(-1, $Aqua)
    GUICtrlCreateLabel($NetWorkPath_Root, 160, $iH + $lf * 8, 300)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel($NetWorkPath_System, 160, $iH + $lf * 9, 300)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel($NetWorkPath_Log, 160, $iH + $lf * 10, 300)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel($NetWorkPath_Method, 160, $iH + $lf * 11, 300)
    GuiCtrlSetBkColor(-1, $Yellow)
    GUICtrlCreateLabel($NetWorkPath_Template, 160, $iH + $lf * 12, 300)
    GuiCtrlSetBkColor(-1, $Yellow)

    ; GROUP WITH RADIO BUTTONS
    $Paper_Format_ID = GuiCtrlCreateGroup("Paper format", 160, $iH + $lf * 14, 100, 70)
    GUICtrlSetBkColor(-1, $Khaki)
    $Paper_A4 = GuiCtrlCreateRadio("A4", 180, $iH + $lf * 15, 60)
    GUICtrlSetBkColor(-1, $Khaki)
    GuiCtrlSetState($Paper_A4, $GUI_CHECKED)
    $Paper_Letter = GuiCtrlCreateRadio("Letter", 180, $iH + $lf * 16, 60)
    GUICtrlSetBkColor(-1, $Khaki)
    GUICtrlCreateGroup ("",-99, -99, 1, 1) ;close group

    $startInstallation = GUICtrlCreateButton("Start installation", 360, $iH + $lf * 14.5, 100)
    GuiCtrlSetBkColor(-1, $SpringGreen)
    $Terminate = GUICtrlCreateButton("Terminate", 360, $iH + $lf * 16, 100)
    GuiCtrlSetBkColor(-1, $OrangeRed)
    ;Show window/Make the window visible
    GUISetState(@SW_SHOW)

    ;Loop until:
    ;- user presses Esc
    ;- user presses Alt+F4
    ;- user clicks the close button
    While 1
    ;After every loop check if the user clicked something in the GUI window
    $msg = GUIGetMsg()

    Select
    Case $msg = $startInstallation
    $Paper_A4 = GUICtrlRead($Paper_A4)
    $Paper_Letter = GUICtrlRead($Paper_Letter)
    GUICtrlSetState($startInstallation, $GUI_HIDE)
    GUICtrlSetState($Terminate, $GUI_HIDE)
    $progressbar1 = GUICtrlCreateProgress(280, $iH + $lf * 14.5, 180, 20)
    ExitLoop
    Case $msg = $Terminate
    ;Destroy the GUI including the controls
    GUIDelete()
    Exit
    Case $msg = $GUI_EVENT_CLOSE
    ;Destroy the GUI including the controls
    GUIDelete()
    ;Exit the script
    Exit
    EndSelect

    WEnd

    EndFunc ;==>myBHC_GUI
    ;-------------------------------------------------


    Ich hoffe, dass ich das mit dem Spoiler jetzt richtig gemacht habe, ansonsten auch noch Info wie ich das machen kann.

    Vielen Dank
    RoWi :)

  • Ehem...erstmal: im Spoiler solltest du auch noch die AutoIt-Quellcodetags benutzen (der knopf dafür ist rechts neben dem Spoiler).
    2. Hast du schonmal versucht zwischendurch wichtige Variablen auszugeben (debugg-msgboxes)
    Ich denke das Problem entsteht aus dem Status "INVALID" heraus. Willst du nicht einfach den Laufwerknamen mit

    [autoit]

    StringLeft($NetWorkPath_System, 2)

    [/autoit]

    auslesen?
    Denn mit

    [autoit]

    DriveGetType

    [/autoit]

    kannst du nur den Typ eines Laufwerks überprüfen und nicht den eines Pfades...aber es reicht ja schon wenn du überprüfst, ob das Laufwerk
    ein Netzlaufwerk ist oder?

    Bild1: Ich beim debuggen

  • Hallo General Kaboom,

    danke für die Hinweise.

    Ich lasse mir die Infos immer aus MsgBoxes anzeigen.

    Wie schon gesagt, die Meldung "Status INVALID" erscheint nur auf der Win7 Maschine, auf dem WinXP Rechner erscheint als Meldung "Status READY".
    Auf der WinXP Maschine wird der Laufwerkstyp mit "NETWORK" korrekt ermitelt, nur bei Win7 nicht.
    Da das Script in einer gemischten Umgebung mit WinXP und auch Win7 Maschinen zum Einsatz kommt, brauche ich diese Info über den Laufwerkstyp.

    Danke
    RoWi

  • Ich greife in meiner Testumgebung sowohl von dem WinXP System qals auch von dem Win7 System auf den selben Serverpfad zu, daher mein Biss in die Tischkante.

  • Danke General Kaboom für Deine Mühen,

    ich drücke die Daumen, dass Du eine Lösung für mich findest.
    :thumbup:

    • Offizieller Beitrag

    "Net use" aus AutoIt aufrufen oder wie?


    Genau, und die Rückgabe dann auswerten:

    [autoit]

    #include <Constants.au3>
    Local $foo = Run(@ComSpec & " /c " & 'net use', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    Local $data
    While True
    $data &= StdoutRead($foo)
    If @error Then ExitLoop
    Sleep(25)
    WEnd
    ConsoleWrite($data & @CRLF)

    [/autoit]
  • Hallo BugFix,

    danke für Deine Hilfe.

    Ich habe es so auf dem WinXP System ausprobiert und läuft auch, aber auf Win7 ............ genau wie vorher.
    Es scheint, dass es Probleme mit der Zugriffberechtigung (obwohl Administrator') bei Zugriff mit AutoIt auf bestimmte Windows-Funktionen gibt.
    Das AutoIt Script ist compliliert und mit einem Zertifkiat von mir versehen, bei der Ausführung unter Win7 werde ich als 'Verifizierter Herausgeber' angzeigt (Win/ sollte also zufrieden sein).

    Irgendwelche Ideen?

    Danke RoWi

    • Offizieller Beitrag

    Auf meinem Win7 Pro 32Bit läuft es anstandslos. Wie sieht es mit UAC aus? Ist das aktiv? (Ist bei mir als erstes rausgeflogen, schließlich muß ich am PC arbeiten und nicht dauernd bestätigen müssen, dass das, was ich gerade aufrufe auch das ist, was ich gerade tun will :pinch: ).

  • Hallo BugFix,

    was ist UAC?

    Ich habe eben in einer Verzweiflungstat auf dem Win7 System nur DriveGetType und DriveGetSatus für das Laufwerk "C:\" probiert und läuft, also ist der Zugriff auf Netzwerkinformationen unterbunden ?!? ?(