Jump to content

if none of these conditions apply...


gcue
 Share

Recommended Posts

i have this for every letter of the alphabet

$Adrv = RegRead("\\" & GuiCtrlRead($asset) & "\HKEY_CURRENT_USER\Network\A", "RemotePath")

If NOT @ERROR Then

MsgBox(512, 'Locally Mapped Drives', 'PC: '& GuiCtrlRead($asset) &@crlf& _
        'User: ' & $user &@crlf& _
        'Drive: A'&@crlf& _
        'Path: ' & $Adrv )
EndIf

how can i put a condition which would be.. if none of these exist, then msgbox "no locally mapped drives"

thanks

Link to comment
Share on other sites

i have this for every letter of the alphabet

$Adrv = RegRead("\\" & GuiCtrlRead($asset) & "\HKEY_CURRENT_USER\Network\A", "RemotePath")

If NOT @ERROR Then

MsgBox(512, 'Locally Mapped Drives', 'PC: '& GuiCtrlRead($asset) &@crlf& _
        'User: ' & $user &@crlf& _
        'Drive: A'&@crlf& _
        'Path: ' & $Adrv )
EndIf

how can i put a condition which would be.. if none of these exist, then msgbox "no locally mapped drives"

thanks

Just threw in a counter to check for mapped drives. As for usage of the same block of code over and over for each letter of the alphabet, remember: Arrays are your friend!

(Not fully tested, but the basic concept is covered):

CODE

$iMappedDrives = Int(0)

Dim $aDriveList[27] = ["26", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

For $i = 1 To $aDriveList[0]

$Adrv = RegRead("\\" & GUICtrlRead($asset) & "\HKEY_CURRENT_USER\Network\" & $aDriveList[$i], "RemotePath")

If Not @error Then

MsgBox(512, 'Locally Mapped Drives', 'PC: ' & GUICtrlRead($asset) & @CRLF & _

'User: ' & $user & @CRLF & _

'Drive: A' & @CRLF & _

'Path: ' & $Adrv)

$iMappedDrives += 1

EndIf

Next

If $iMappedDrives > Int(1) Then

MsgBox(64, "Mapped drives", $iMappedDrives & " mapped drives found on the target system.")

Else

MsgBox(64, "Mapped drives", "No mapped drives found on the target system.")

EndIf

Edit: Grammar Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

that worked great!

but how do i refer to the drive letter here:

'Drive: A' & @CRLF & _

so instead of "A" it shows the letter it's using..

i tried $aDriveList[$i] but that ddint work

thanks for your help!!

Just threw in a counter to check for mapped drives. As for usage of the same block of code over and over for each letter of the alphabet, remember: Arrays are your friend!

(Not fully tested, but the basic concept is covered):

CODE

$iMappedDrives = Int(0)

Dim $aDriveList[27] = ["26", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]

For $i = 1 To $aDriveList[0]

$Adrv = RegRead("\\" & GUICtrlRead($asset) & "\HKEY_CURRENT_USER\Network\" & $aDriveList[$i], "RemotePath")

If Not @error Then

MsgBox(512, 'Locally Mapped Drives', 'PC: ' & GUICtrlRead($asset) & @CRLF & _

'User: ' & $user & @CRLF & _

'Drive: A' & @CRLF & _

'Path: ' & $Adrv)

$iMappedDrives += 1

EndIf

Next

If $iMappedDrives > Int(1) Then

MsgBox(64, "Mapped drives", $iMappedDrives & " mapped drives found on the target system.")

Else

MsgBox(64, "Mapped drives", "No mapped drives found on the target system.")

EndIf

Edit: Grammar
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...