Sign in to follow this  
Followers 0

don't forget your usb key

21 posts in this topic

Posted

Hello,

when I'm at office and I lock my session with ctrl alt suppr, I'm allways afraid of forgetting my memory stick or a CD.

I have written this tool which control if CD, floppy disk, or other removable devices are present when I press ctrl and alt.

In this case it use the intern speaker to make a beep even if I have already pressed the key suppr.

Bye

detect_perif3.au3

Share this post


Link to post
Share on other sites



Posted

Oups i forget it !!!! :):D:D

Share this post


Link to post
Share on other sites

Posted

This is clever and useful, keep it up!

Share this post


Link to post
Share on other sites

Posted

; thanks to the person who has written this function ;-)

It is me. You are welcome.

Share this post


Link to post
Share on other sites

Posted

sorry for bumping this, but why dont you make a popup box saying a thumb drive is still plugged in instead of beeping.

Share this post


Link to post
Share on other sites

Posted

Copied&Pasted from the source code itself:

if $alarme=1 Then MsgBox(16,"Support(s) oublié(s) !!","Attention au moins support a été oublié:"&@CRLF&$listsupport) ; generally the message is coming too late, but the "beep" is played even if the session is locked

Share this post


Link to post
Share on other sites

Posted

thanks ezzetabi, i turned the msg box into a traytip. Now i m trying to make the box tip run without hotkeys but i cant find the code for the hotkeys. I m new to autoit so if i find it do i leave the hotkey field blank? does this mean the script will run without hotkey? also anyone tell me how to make the tray tip run every 5mins and run the script at startup

Share this post


Link to post
Share on other sites

Posted

may help:

Local $d
Local Const $min = 5

While 1
   $d = DriveGetDrive( "REMOVABLE" )
   If not @error Then
	  TrayTip('Removable disk detected', 'Remember to unplug it, soon or later...', 10, 2)
   EndIf
   
   Sleep($min * 60 * 1000)
WEnd

and seek for something called 'startup folder'

Share this post


Link to post
Share on other sites

Posted

yeah i think i understand the script but i dunno where to place it. Can you mod the script and post it here? thanks. Also, how do i make t run without hotkey?

Share this post


Link to post
Share on other sites

Posted

yeah i think i understand the script but i dunno where to place it. Can you mod the script and post it here? thanks. Also, how do i make t run without hotkey?

<{POST_SNAPBACK}>

ezzetabi's code is a script in itself. Just run it.

Share this post


Link to post
Share on other sites

Posted

i see, can u just briefly tell me why the lenght has been dramaticallyshorten and still doen the job?

Share this post


Link to post
Share on other sites

Posted

The first one beeps when you lock the console of the computer. The second one will get you a Tray Icon Notification (bubble) every 5 minutes, reminding you that there is a removable drive, it won't beep when you lock the console though.

If you wanted, you could combine the both of them for even more reminders...

Share this post


Link to post
Share on other sites

Posted

Hello every body,

I'm surprised, I thought that this old topic was forgotten ...

Just for information, I have replaced the single beep :

run(@comspec&" /c "&chr(7),"",@SW_HIDE)

by

run("beep2.exe")

beep2.exe, is the compiled form of this script

Dim $tab[17]
$do2=132  
$re2=148.5  
$mi2=165  
$fa2=176  
$sol2=198  
$la2=220  
$si2=247.5  
$do3=264  
$re3=297  
$mi3=330  
$fa3=352  
$sol3=396  
$la3=440  
$si3=495  
$do4=528  
$re4=594  
$mi4=660  
$fa4=704  
$sol4=792  
$la4=880  
$si4=990
;$hertz = 550
$duration = 500
$tab[0]=$do3
$tab[1]=$re3
$tab[2]=$mi3
$tab[3]=$do3

$tab[4]=$mi3
$tab[5]=$fa3
$tab[6]=$sol3

$tab[7]=$sol3
$tab[8]=$la3
$tab[9]=$sol3
$tab[10]=$fa3
$tab[11]=$mi3
$tab[12]=$do3

$tab[13]=$do3
$tab[14]=$sol2
$tab[15]=$do3

$tab[16]=0
for $cpt=0 to 1
	For $cpt2=0 to 3
	DllCall ("kernel32.dll", "long", "Beep", "long", $tab[$cpt2], "long", $duration)
	Next
Next
DllCall ("kernel32.dll", "long", "Beep", "long", $tab[16], "long", $duration)

for $cpt=0 to 1
	For $cpt2=4 to 6
	DllCall ("kernel32.dll", "long", "Beep", "long", $tab[$cpt2], "long", $duration)
	Next
Next
DllCall ("kernel32.dll", "long", "Beep", "long", $tab[16], "long", $duration)

for $cpt=0 to 1
	For $cpt2=7 to 12
	DllCall ("kernel32.dll", "long", "Beep", "long", $tab[$cpt2], "long", $duration)
	Next
Next
DllCall ("kernel32.dll", "long", "Beep", "long", $tab[16], "long", $duration)

for $cpt=0 to 1
	For $cpt2=13 to 15
	DllCall ("kernel32.dll", "long", "Beep", "long", $tab[$cpt2], "long", $duration)
	Next
Next
DllCall ("kernel32.dll", "long", "Beep", "long", $tab[16], "long", $duration)

It plays a little melody with the internal speaker, it's longer and more funy than a single beep ... :(

Share this post


Link to post
Share on other sites

Posted

I've just tested this. It works with ctrl-alt-del but not when I press Win-L

Can you tell me how to include this also ?

Share this post


Link to post
Share on other sites

Posted

Hello,

when I'm at office and I lock my session with ctrl alt suppr, I'm allways afraid of forgetting my memory stick or a CD.

I have written this tool which control if CD, floppy disk, or other removable devices are present when I press ctrl and alt.

In this case it use the intern speaker to make a beep even if I have already pressed the key suppr.

Bye

detect_perif3.au3

Hey does anyone still use this????? What do you reformat the script to, to run it?? Please help me!!!!!!!!!!

Share this post


Link to post
Share on other sites

Posted

What problems are you having? It is a 5 year old thread after all... :idea:

Share this post


Link to post
Share on other sites

Posted

What problems are you having? It is a 5 year old thread after all... :idea:

Thanks 4 responding I didn't expect a response. I really would like the beep to play through the external speakers because the computer speakers aren't always turned on, and I haven't been able to get the message to appear at all. I even have embedded the script in the logg of folder. Is there a file that would play the sound through the internal speakers in the path enviroment???

Share this post


Link to post
Share on other sites

Posted

Hey does anyone still use this????? What do you reformat the script to, to run it?? Please help me!!!!!!!!!!

Well.. Code of 2005, it is older then the the most users here, Thing is.. cool stuff and so on, but legacy code.. This was for 3.1.x.x ?

If you learn autoit a bit you can remake it your self :idea:

Share this post


Link to post
Share on other sites

Posted

Replace beep with something like _SoundPlay() or similar to play a recorded sound...

Share this post


Link to post
Share on other sites

Posted (edited)

A nice script but it's quite slow if your computer has a floppy disk.

Edited by logmein

Share this post


Link to post
Share on other sites

Posted

Slightly different take...

Still uses the same basic concept

#include <Misc.au3>
;False = Beep, True = Play Sound
$sound = True
;Visible
$show_error = True

$dlist = _ListDrives()

While 1
	Sleep(100)
	If _IsPressed("a5") <> 1 Then ; test if the AltGR key is not pressed. This test avoids that the program executes the function detect() when this key is pressed because AltGR => ctrl +alt (it's not always true but in our case it is)
		If _IsPressed("11") Then ; test if the Ctrl key is pressed
			If _IsPressed("12") Then ;test if the alt key is pressed
				_CheckDrives()
			EndIf
		EndIf
	EndIf
WEnd

Func _CheckDrives()
	$c = 0
	$a = DriveGetDrive("REMOVABLE")
	If Not @error Then $c += $a[0]
	$b = DriveGetDrive("CDROM")
	If Not @error Then $c += $b[0]
	If $c > $dlist[0] Then $dlist = _ListDrives()
	For $i = 1 To $dlist[0]
		If DriveStatus($dlist[$i] & "\") = "READY" Then
			If $sound = True Then
				SoundPlay(@WindowsDir & "\media\tada.wav", 1)
			Else
				For $i = 1 To 10
					Beep(500, 200)
					Sleep(20)
				Next
			EndIf
			If $show_error Then MsgBox (0, "Check Drive", "Please check drive """ & $dlist[$I] & """ for media.")
		EndIf
	Next
EndFunc   ;==>_CheckDrives

Func _ListDrives()
	Local $big_array[1], $count = 1
	$cds = DriveGetDrive("CDROM")
	If Not @error Then
		ReDim $big_array[UBound($big_array) + $cds[0]]
		For $i = 1 To $cds[0]
			$big_array[$count] = $cds[$i]
			$count += 1
		Next
	EndIf
	$cds = DriveGetDrive("REMOVABLE")
	If Not @error Then
		ReDim $big_array[UBound($big_array) + $cds[0]]
		For $i = 1 To $cds[0]
			$big_array[$count] = $cds[$i]
			$count += 1
		Next
	EndIf
	$big_array[0] = $count - 1
	Return $big_array
EndFunc   ;==>_ListDrives

Maybe a little faster?

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.