Jump to content

diver info(external or flash disk )


Recommended Posts

hi ,new flash disk put in the pc

Extrem Hard Disk or USB Recording inthe Computer

dont write info new flash disk

why ,

info flashdisk put inthe pc

ı want to make flash disk((external or flash disk) recordkeeping

but dont worked

code:

Dim $yazildi

$oldvar=DriveGetDrive("all")

HotKeySet( '{esc}', "Terminate")

opt("OnExitFunc", "Terminate")

#NoTrayIcon

$log = @ScriptDir &"/flash.txt"

$var = DriveGetDrive( "all" )

if $var <> $oldvar then

$degisim=1

else

$degisim=0

$oldvar=$var

endif

$ff=""

While 1

If NOT @error Then

if $degisim=1 Then

$yazildi=0

$degisim=0

endif

FileOpen($log, 1)

For $i = 1 to $var[0]

If NOT @error and $var[$i] > "f" and $ff="" and $yazildi=0 Then

FileWrite($log,$var[$i] &@MDAY & "." & @MON & "." & @YEAR& " " & @HOUR & ":" & @MIN & ":" & @SEC & " name: "&DriveGetLabel($var[$i] )&" Serial: " & DriveGetSerial($var[$i] ) &" total: "& Round ( DriveSpaceTotal($var[$i] ) )& @CRLF )

$gg=DriveGetLabel($var[0] )

$ff= $gg

EndIf

Next

$yazildi=1

EndIf

FileClose($log)

$ff=""

WEnd

Func Terminate()

FileClose($log)

Exit

EndFunc

new flash dont write why?

thank you for help

Edited by mesale0077
Link to comment
Share on other sites

sorry but if it is a little more explanatory , it would be helpful.

to start with, please use code tags, 1 this text entry wastes space, 2 its not very readable.

next, if i understand right, u want a code to log all new portable drives like hdd or flash drive to be logged, right?

in that case, check the codes available here to monitor disc change activity, 'usb drive monitoring'

Dim $yazildi
$oldvar=DriveGetDrive("all")
HotKeySet( '{esc}', "Terminate")
opt("OnExitFunc", "Terminate")
#NoTrayIcon
$log = @ScriptDir &"/flash.txt"
$var = DriveGetDrive( "all" )
if $var <> $oldvar then
$degisim=1
else
$degisim=0
$oldvar=$var
endif
$ff=""
While 1
If NOT @error Then
if $degisim=1 Then
$yazildi=0
$degisim=0
endif
FileOpen($log, 1)
For $i = 1 to $var[0]
If NOT @error and $var[$i] > "f" and $ff="" and $yazildi=0 Then
FileWrite($log,$var[$i] &@MDAY & "." & @MON & "." & @YEAR& " " & @HOUR & ":" & @MIN & ":" & @SEC & " name: "&DriveGetLabel($var[$i] )&" Serial: " & DriveGetSerial($var[$i] ) &" total: "& Round ( DriveSpaceTotal($var[$i] ) )& @CRLF )
$gg=DriveGetLabel($var[0] )
$ff= $gg

EndIf
Next
$yazildi=1
EndIf

FileClose($log)
$ff=""
WEnd
Func Terminate()
FileClose($log)
Exit
EndFunc
Edited by rajeshontheweb
Link to comment
Share on other sites

  • 1 month later...

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...