Sammys Themen

  • Ich hab jetzt mal angefangen.

    Funktion: EncryptPassword

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: EncryptPassword
    ; Description::
    ; Parameter(s): $file = Datei mit dem Passwort
    ; Requirement(s):
    ; Return Value(s):
    ; Author(s): Sammy <[email='SammyWorld@gmx.net'][/email]
    ;
    ; Danke an Wes Wolfe-Wolvereness
    ;
    ;===============================================================================
    ;
    Func EncryptPassword($file)

    ; Variablen-Deklaration
    Local $v_EncryptModified
    Local $i_EncryptCountH
    Local $i_EncryptCountG
    Local $v_EncryptSwap
    Local $av_EncryptBox[256][2]
    Local $i_EncryptCountA
    Local $i_EncryptCountB
    Local $i_EncryptCountC
    Local $i_EncryptCountD
    Local $i_EncryptCountE
    Local $v_EncryptCipher
    Local $v_EncryptCipherBy

    ; Öffne Datei zum Lesen des Passworts
    FileOpen($file, 0)
    $text = FileReadLine($file, 1)
    FileClose($file)

    ; Öffne Datei zum Schreiben des verschlüsselten Passworts
    FileOpen($file, 2)
    FileWriteLine($file, $encrypttext)
    FileClose($file)

    EndFunc ;==>EncryptPassword

    [/autoit]

    Funktion: DecryptPassword

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: DecryptPassword
    ; Description::
    ; Parameter(s): $file = Datei mit dem verschlüsselten Passwort
    ; Requirement(s):
    ; Return Value(s):
    ; Author(s): Sammy <[email='SammyWorld@gmx.net'][/email]
    ;
    ; Danke an Wes Wolfe-Wolvereness
    ;
    ;===============================================================================
    ;
    Func DecryptPassword($file)

    ; Variablen-Deklaration
    Local $v_EncryptModified
    Local $i_EncryptCountH
    Local $i_EncryptCountG
    Local $v_EncryptSwap
    Local $av_EncryptBox[256][2]
    Local $i_EncryptCountA
    Local $i_EncryptCountB
    Local $i_EncryptCountC
    Local $i_EncryptCountD
    Local $i_EncryptCountE
    Local $v_EncryptCipher
    Local $v_EncryptCipherBy

    ; Öffne Datei zum Lesen des verschlüsselten Passworts
    FileOpen($file, 0)
    $text = FileReadLine($file, 1)
    FileClose($file)

    ; Öffne Datei zum Schreiben des Passworts
    FileOpen($file, 2)
    FileWriteLine($file, $encrypttext)
    FileClose($file)

    EndFunc ;==>DecryptPassword

    [/autoit]

    Funktion: _StringEncrypt von Wes Wolfe-Wolvereness

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: _StringEncrypt()
    ; Description: RC4 Based string encryption
    ; Parameter(s): $i_Encrypt - 1 to encrypt, 0 to decrypt
    ; $s_EncryptText - string to encrypt
    ; $s_EncryptPassword - string to use as an encryption password
    ; $i_EncryptLevel - integer to use as number of times to encrypt string
    ; Requirement(s): None
    ; Return Value(s): On Success - Returns the string encrypted (blank) times with (blank) password
    ; On Failure - Returns a blank string and sets @error = 1
    ; Author(s): Wes Wolfe-Wolvereness <Weswolf at aol dot com>
    ;
    ;===============================================================================
    ;
    Func _StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword, $i_EncryptLevel = 1)
    If $i_Encrypt <> 0 And $i_Encrypt <> 1 Then
    SetError(1)
    Return ''
    ElseIf $s_EncryptText = '' Or $s_EncryptPassword = '' Then
    SetError(1)
    Return ''
    Else
    If Number($i_EncryptLevel) <= 0 Or Int($i_EncryptLevel) <> $i_EncryptLevel Then $i_EncryptLevel = 1
    Local $v_EncryptModified
    Local $i_EncryptCountH
    Local $i_EncryptCountG
    Local $v_EncryptSwap
    Local $av_EncryptBox[256][2]
    Local $i_EncryptCountA
    Local $i_EncryptCountB
    Local $i_EncryptCountC
    Local $i_EncryptCountD
    Local $i_EncryptCountE
    Local $v_EncryptCipher
    Local $v_EncryptCipherBy
    If $i_Encrypt = 1 Then
    #region Inhalt verschlüsseln
    For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
    $i_EncryptCountG = ''
    $i_EncryptCountH = ''
    $v_EncryptModified = ''
    For $i_EncryptCountG = 1 To StringLen($s_EncryptText)
    If $i_EncryptCountH = StringLen($s_EncryptPassword) Then
    $i_EncryptCountH = 1
    Else
    $i_EncryptCountH = $i_EncryptCountH + 1
    EndIf
    $v_EncryptModified = $v_EncryptModified & Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255))
    Next
    $s_EncryptText = $v_EncryptModified
    $i_EncryptCountA = ''
    $i_EncryptCountB = 0
    $i_EncryptCountC = ''
    $i_EncryptCountD = ''
    $i_EncryptCountE = ''
    $v_EncryptCipherBy = ''
    $v_EncryptCipher = ''
    $v_EncryptSwap = ''
    $av_EncryptBox = ''
    Local $av_EncryptBox[256][2]
    For $i_EncryptCountA = 0 To 255
    $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1))
    $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
    Next
    For $i_EncryptCountA = 0 To 255
    $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
    $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
    $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
    $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
    Next
    For $i_EncryptCountA = 1 To StringLen($s_EncryptText)
    $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
    $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
    $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
    $v_EncryptCipherBy = BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountA, 1)), $i_EncryptCountE)
    $v_EncryptCipher = $v_EncryptCipher & Hex($v_EncryptCipherBy, 2)
    Next
    $s_EncryptText = $v_EncryptCipher
    Next
    #endregion Inhalt verschlüsseln
    Else
    #region Inhalt entschlüsseln
    For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
    $i_EncryptCountB = 0
    $i_EncryptCountC = ''
    $i_EncryptCountD = ''
    $i_EncryptCountE = ''
    $v_EncryptCipherBy = ''
    $v_EncryptCipher = ''
    $v_EncryptSwap = ''
    $av_EncryptBox = ''
    Local $av_EncryptBox[256][2]
    For $i_EncryptCountA = 0 To 255
    $av_EncryptBox[$i_EncryptCountA][1] = Asc(StringMid($s_EncryptPassword, Mod($i_EncryptCountA, StringLen($s_EncryptPassword)) + 1, 1))
    $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
    Next
    For $i_EncryptCountA = 0 To 255
    $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
    $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
    $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
    $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
    Next
    For $i_EncryptCountA = 1 To StringLen($s_EncryptText) Step 2
    $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
    $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
    $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
    $v_EncryptCipherBy = BitXOR(Dec(StringMid($s_EncryptText, $i_EncryptCountA, 2)), $i_EncryptCountE)
    $v_EncryptCipher = $v_EncryptCipher & Chr($v_EncryptCipherBy)
    Next
    $s_EncryptText = $v_EncryptCipher
    $i_EncryptCountG = ''
    $i_EncryptCountH = ''
    $v_EncryptModified = ''
    For $i_EncryptCountG = 1 To StringLen($s_EncryptText)
    If $i_EncryptCountH = StringLen($s_EncryptPassword) Then
    $i_EncryptCountH = 1
    Else
    $i_EncryptCountH = $i_EncryptCountH + 1
    EndIf
    $v_EncryptModified = $v_EncryptModified & Chr(BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)), Asc(StringMid($s_EncryptPassword, $i_EncryptCountH, 1)), 255))
    Next
    $s_EncryptText = $v_EncryptModified
    Next
    #endregion Inhalt entschlüsseln
    EndIf
    Return $s_EncryptText
    EndIf
    EndFunc ;==>_StringEncrypt

    [/autoit]

    Nun habe ich folgendes Problem ich möchte gerne Teile von _StringEncrypt in meine zwei Funktion einbauen. _StringEncypt enthält 2 Funktionen

  • €: Da war peethebee wohl schneller.
    Das einbauen sollte auch ziemlich einfach sein, einfach den 1. parameter beachten , welchen Wert du für Encrypten und Decrypten angeben musst steht ja in der Funktion und dann kansnte das oben einsetzen.

    Einmal editiert, zuletzt von Daniel W. (27. Oktober 2006 um 23:10)

  • Die Funktion EncyrptPassword funktioniert jetzt

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: EncryptPassword
    ; Description:: Verschlüsselt ein Passwort in einer Datei
    ; Parameter(s): $file = Datei mit dem Passwort
    ; Requirement(s): None.
    ; Return Value(s): $v_EncryptCipher = Verschlüsselte Passwort
    ; Author(s): Sammy <[email='SammyWorld@gmx.net'][/email]
    ;
    ; Danke an Wes Wolfe-Wolvereness für die Funktion _StringEncrypt
    ;
    ;===============================================================================
    ;
    Func EncryptPassword($file)

    #region ----- Variablen-Deklaration -----
    Local $v_EncryptModified
    Local $i_EncryptCountH
    Local $i_EncryptCountG
    Local $v_EncryptSwap
    Local $av_EncryptBox[256][2]
    Local $i_EncryptCountA
    Local $i_EncryptCountB
    Local $i_EncryptCountC
    Local $i_EncryptCountD
    Local $i_EncryptCountE
    Local $v_EncryptCipher
    Local $v_EncryptCipherBy
    Local $i_EncryptLevel = 1
    #endregion ----- Variablen-Deklaration -----

    ; Öffne Datei zum Lesen des Passworts
    FileOpen($file, 0)
    $s_EncryptText = FileReadLine($file, 1)
    FileClose($file)

    #region ----- Passwort-Verschlüsselung -----
    For $i_EncryptCountF = 0 To $i_EncryptLevel Step 1
    $i_EncryptCountG = ''
    $i_EncryptCountH = ''
    $v_EncryptModified = ''
    For $i_EncryptCountG = 1 To StringLen($s_EncryptText)
    $v_EncryptModified = $v_EncryptModified & Chr(Asc(StringMid($s_EncryptText, $i_EncryptCountG, 1)))
    Next
    $s_EncryptText = $v_EncryptModified
    $i_EncryptCountA = ''
    $i_EncryptCountB = 0
    $i_EncryptCountC = ''
    $i_EncryptCountD = ''
    $i_EncryptCountE = ''
    $v_EncryptCipherBy = ''
    $v_EncryptCipher = ''
    $v_EncryptSwap = ''
    $av_EncryptBox = ''
    Local $av_EncryptBox[256][2]
    For $i_EncryptCountA = 0 To 255
    $av_EncryptBox[$i_EncryptCountA][0] = $i_EncryptCountA
    Next
    For $i_EncryptCountA = 0 To 255
    $i_EncryptCountB = Mod(($i_EncryptCountB + $av_EncryptBox[$i_EncryptCountA][0] + $av_EncryptBox[$i_EncryptCountA][1]), 256)
    $v_EncryptSwap = $av_EncryptBox[$i_EncryptCountA][0]
    $av_EncryptBox[$i_EncryptCountA][0] = $av_EncryptBox[$i_EncryptCountB][0]
    $av_EncryptBox[$i_EncryptCountB][0] = $v_EncryptSwap
    Next
    For $i_EncryptCountA = 1 To StringLen($s_EncryptText)
    $i_EncryptCountC = Mod(($i_EncryptCountC + 1), 256)
    $i_EncryptCountD = Mod(($i_EncryptCountD + $av_EncryptBox[$i_EncryptCountC][0]), 256)
    $i_EncryptCountE = $av_EncryptBox[Mod(($av_EncryptBox[$i_EncryptCountC][0] + $av_EncryptBox[$i_EncryptCountD][0]), 256) ][0]
    $v_EncryptCipherBy = BitXOR(Asc(StringMid($s_EncryptText, $i_EncryptCountA, 1)), $i_EncryptCountE)
    $v_EncryptCipher = $v_EncryptCipher & Hex($v_EncryptCipherBy, 2)
    Next
    Next
    #endregion ----- Passwort-Verschlüsselung -----

    ; Öffne Datei zum Schreiben des verschlüsselten Passworts
    FileOpen($file, 2)
    FileWriteLine($file, $v_EncryptCipher)
    FileClose($file)

    EndFunc ;==>EncryptPassword

    [/autoit]

    Nur die Funktion DecryptPassword funktioniert noch nicht

    Spoiler anzeigen
    [autoit]


    ;===============================================================================
    ;
    ; Function Name: DecryptPassword
    ; Description::
    ; Parameter(s): $file = Datei mit dem verschlüsselten Passwort
    ; Requirement(s):
    ; Return Value(s):
    ; Author(s): Sammy <[email='SammyWorld@gmx.net'][/email]
    ;
    ; Danke an Wes Wolfe-Wolvereness
    ;
    ;===============================================================================
    ;
    Func DecryptPassword($file)

    #region ----- Variablen-Deklaration -----
    Local $v_DecryptModified
    Local $i_DecryptCountH
    Local $i_DecryptCountG
    Local $v_DecryptSwap
    Local $av_DecryptBox[256][2]
    Local $i_DecryptCountA
    Local $i_DecryptCountB
    Local $i_DecryptCountC
    Local $i_DecryptCountD
    Local $i_DecryptCountE
    Local $v_DecryptCipher
    Local $v_DecryptCipherBy
    Local $i_DecryptLevel = 1
    #endregion ----- Variablen-Deklaration -----

    ; Öffne Datei zum Lesen des verschlüsselten Passworts
    FileOpen($file, 0)
    $s_DecryptText = FileReadLine($file, 1)
    FileClose($file)

    #region ----- Passwort-Entschlüsselung -----
    For $i_DecryptCountF = 0 To $i_DecryptLevel Step 1
    $i_DecryptCountB = 0
    $i_DecryptCountC = ''
    $i_DecryptCountD = ''
    $i_DecryptCountE = ''
    $v_DecryptCipherBy = ''
    $v_DecryptCipher = ''
    $v_DecryptSwap = ''
    $av_DecryptBox = ''
    Local $av_DecryptBox[256][2]
    For $i_DecryptCountA = 0 To 255
    ;~ $av_DecryptBox[$i_DecryptCountA][1] = Asc(StringMid($s_DecryptPassword, Mod($i_DecryptCountA, StringLen($s_DecryptPassword)) + 1, 1))
    $av_DecryptBox[$i_DecryptCountA][0] = $i_DecryptCountA
    Next
    For $i_DecryptCountA = 0 To 255
    $i_DecryptCountB = Mod(($i_DecryptCountB + $av_DecryptBox[$i_DecryptCountA][0] + $av_DecryptBox[$i_DecryptCountA][1]), 256)
    $v_DecryptSwap = $av_DecryptBox[$i_DecryptCountA][0]
    $av_DecryptBox[$i_DecryptCountA][0] = $av_DecryptBox[$i_DecryptCountB][0]
    $av_DecryptBox[$i_DecryptCountB][0] = $v_DecryptSwap
    Next
    For $i_DecryptCountA = 1 To StringLen($s_DecryptText) Step 2
    $i_DecryptCountC = Mod(($i_DecryptCountC + 1), 256)
    $i_DecryptCountD = Mod(($i_DecryptCountD + $av_DecryptBox[$i_DecryptCountC][0]), 256)
    $i_DecryptCountE = $av_DecryptBox[Mod(($av_DecryptBox[$i_DecryptCountC][0] + $av_DecryptBox[$i_DecryptCountD][0]), 256) ][0]
    $v_DecryptCipherBy = BitXOR(Dec(StringMid($s_DecryptText, $i_DecryptCountA, 2)), $i_DecryptCountE)
    $v_DecryptCipher = $v_DecryptCipher & Chr($v_DecryptCipherBy)
    Next
    $s_DecryptText = $v_DecryptCipher
    $i_DecryptCountG = ''
    $i_DecryptCountH = ''
    $v_DecryptModified = ''
    For $i_DecryptCountG = 1 To StringLen($s_DecryptText)
    ;~ If $i_DecryptCountH = StringLen($s_DecryptPassword) Then
    ;~ $i_DecryptCountH = 1
    ;~ Else
    ;~ $i_DecryptCountH = $i_DecryptCountH + 1
    ;~ EndIf
    $v_DecryptModified = $v_DecryptModified & Chr(Asc(StringMid($s_DecryptText, $i_DecryptCountG, 1))) ; , Asc(StringMid($s_DecryptPassword, $i_DecryptCountH, 1)), 255))
    Next
    $s_DecryptText = $v_DecryptModified
    Next
    #endregion ----- Passwort-Entschlüsselung -----

    ; Öffne Datei zum Schreiben des Passworts
    FileOpen($file, 2)
    FileWriteLine($file, $v_DecryptModified)
    FileClose($file)

    EndFunc ;==>DecryptPassword

    [/autoit]

    Edit: Anderes Thema: Wie kann ich eigentlich die Beschreibung einer Datei auslesen. z.B. Bei KBs "Security Update"

    Einmal editiert, zuletzt von Sammy (28. Oktober 2006 um 13:28)

    • Offizieller Beitrag

    Hi,

    Spoiler anzeigen
    [autoit]

    ;===============================================================================
    ; Function Name: GetExtProperty($sPath,$iProp)
    ; Description: Returns an extended property of a given file.
    ; Parameter(s): $sPath - The path to the file you are attempting to retrieve an extended property from.
    ; $iProp - The numerical value for the property you want returned. If $iProp is is set
    ; to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.
    ; The properties are as follows:
    ; Name = 0
    ; Size = 1
    ; Type = 2
    ; DateModified = 3
    ; DateCreated = 4
    ; DateAccessed = 5
    ; Attributes = 6
    ; Status = 7
    ; Owner = 8
    ; Author = 9
    ; Title = 10
    ; Subject = 11
    ; Category = 12
    ; Pages = 13
    ; Comments = 14
    ; Copyright = 15
    ; Artist = 16
    ; AlbumTitle = 17
    ; Year = 18
    ; TrackNumber = 19
    ; Genre = 20
    ; Duration = 21
    ; BitRate = 22
    ; Protected = 23
    ; CameraModel = 24
    ; DatePictureTaken = 25
    ; Dimensions = 26
    ; Width = 27
    ; Height = 28
    ; Company = 30
    ; Description = 31
    ; FileVersion = 32
    ; ProductName = 33
    ; ProductVersion = 34
    ; Requirement(s): File specified in $spath must exist.
    ; Return Value(s): On Success - The extended file property, or if $iProp = -1 then an array with all properties
    ; On Failure - 0, @Error - 1 (If file does not exist)
    ; Author(s): Simucal ([email='Simucal@gmail.com'][/email])
    ; Note(s):
    ;
    ;===============================================================================

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

    #include <array.au3>
    $path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")
    $prop = _GetExtProperty($path,-1)
    _ArrayDisplay($prop,"Property Array")

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

    Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
    SetError(1)
    Return 0
    Else
    $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
    $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
    $oShellApp = ObjCreate ("shell.application")
    $oDir = $oShellApp.NameSpace ($sDir)
    $oFile = $oDir.Parsename ($sFile)
    If $iProp = -1 Then
    Local $aProperty[35]
    For $i = 0 To 34
    $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
    Next
    Return $aProperty
    Else
    $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
    If $sProperty = "" Then
    Return 0
    Else
    Return $sProperty
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_GetExtProperty

    [/autoit]

    So long,

    Mega

  • Ich hab die Frage schon im Projekt-Forum gestellt und zwar möchte ich gerne bei dem Projekt Windows Post Installer mitprogrammieren.

    Ich hab mal ein kleines Skript für WPI geschrieben und nun werden die MsgBox nicht angezeigt.

    [autoit]


    $drive = StringLower(StringLeft(@ScriptDir, 2))

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

    ; Prüfe ob es ein CD-ROM-Laufwerk ist
    If DriveGetDrive("CDROM") = $drive Then
    MsgBox(64 + 8192, "Hinweis", "Das momentante Laufwerk ist ein CD-Laufwerk.")
    ; Prüfe ob es ein Wechseldatenträger ist
    ElseIf DriveGetDrive("REMOVABLE") = $drive Then
    MsgBox(64 + 8192, "Hinweis", "Das momentante Laufwerk ist ein Wechseldatenträger.")
    ; Prüfe ob es ein Festplatte ist
    ElseIf DriveGetDrive("FIXED") = $drive Then
    MsgBox(64 + 8192, "Hinweis", "Das momentane Laufwerk ist weder ein CD-Laufwerk noch ein Wechseldatenträger.")
    EndIf

    [/autoit]
  • Propertys bei Files ist wenn dein Script funktioniert fertig
    Verschlüsselung EncryptPassword ist fertig. DecryptPassword gibt nicht mehr das Passwort zurück nur Hyroglyphen
    WPI MsgBox werden nicht angezeigt

  • Du meinst die englische Hilfe. Da hab ich nach geschaut. da funktioniert es, aber wieso es bei mir nicht funktioniert weiß ich nicht

    Edit:
    Hab es jetzt mal verändert, MsgBox werden immer noch nicht angezeigt, das TrayIcon erscheint und verschwindet

    [autoit]

    $drive = StringLower(StringLeft(@ScriptDir, 2))

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

    ; Prüfe ob es ein CD-ROM-Laufwerk ist
    If DriveGetDrive("CDROM") = $drive Then
    If Not @error Then
    MsgBox(64 + 8192, "Hinweis", "Das momentante Laufwerk ist ein CD-Laufwerk.")
    EndIf
    ; Prüfe ob es ein Wechseldatenträger ist
    ElseIf DriveGetDrive("REMOVABLE") = $drive Then
    If Not @error Then
    MsgBox(64 + 8192, "Hinweis", "Das momentante Laufwerk ist ein Wechseldatenträger.")
    EndIf
    ; Prüfe ob es ein Festplatte ist
    ElseIf DriveGetDrive("FIXED") = $drive Then
    If Not @error Then
    MsgBox(64 + 8192, "Hinweis", "Das momentane Laufwerk ist weder ein CD-Laufwerk noch ein Wechseldatenträger.")
    EndIf
    EndIf

    [/autoit]

    Einmal editiert, zuletzt von Sammy (30. Oktober 2006 um 15:23)

  • Nur das Problem ist, wenn ich das Beispiel aus der Hilfe nehme wie kann ich dann mein Skript dazu einbauen

    • Offizieller Beitrag

    Hi,

    hier mal ein einfaches Beispiel ohne Schleife:

    Spoiler anzeigen
    [autoit]

    Switch DriveGetType(StringLower(StringLeft(@ScriptDir, 2)))
    case "Unknown"
    MsgBox(0,"DriveType","Unknown")
    case "Removable"
    MsgBox(0,"DriveType","Removable")
    case "Fixed"
    MsgBox(0,"DriveType","Fixed")
    case "Network"
    MsgBox(0,"DriveType","Network")
    case "CDROM"
    MsgBox(0,"DriveType","CDROM")
    case "RAMDisk"
    MsgBox(0,"DriveType","RAMDisk")
    EndSwitch

    [/autoit]

    So long,

    Mega

  • Wo müsste ich dann While-Schleife einbauen. Brauch glaube ich zumindest keine While-Schleife, da es auch so funktioniert

    Einmal editiert, zuletzt von Sammy (30. Oktober 2006 um 16:03)