jftuga Posted November 6, 2006 Share Posted November 6, 2006 I think that I will be running this on startup. Any comments or suggestions are most welcomed. -John expandcollapse popup#cs usb_sling.au3 -John Taylor Nov-6-2006 I always hate how long and how many clicks it takes to safely remove a usb device. This program automates the process, by quickly 'clicking' all of the buttons for you. Run this program in the background. Once you click the USB icon in the system tray, this program takes over and clicks through all of the dialogs for you. http://www.iconarchive.com/icon/hardware/fruit-on-the-hand-by-irondevil/IceUSB.ico #ce #notrayicon Opt("MustDeclareVars", 1) Dim $title="Safely Remove Hardware" Dim $stop ="Stop a Hardware device" _ReduceMemory() while 1 sleep(1500) if WinActive( $title ) then ControlClick( $title, "", "Button2") ; "Stop" sleep(200) if WinActive( $stop ) then ControlClick( $stop, "", "Button1") ; "OK" endif sleep(250) ControlClick( $title, "", "Button3") ; "Close" _ReduceMemory() endif wend Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
Fossil Rock Posted November 6, 2006 Share Posted November 6, 2006 I can't remember ever using the 'safely remove' feature. I just remove it be it a pendrive or compact flash card. I've never experienced any problems, so I don't fully understand the usefulness of it. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
AzKay Posted November 6, 2006 Share Posted November 6, 2006 I can't remember ever using the 'safely remove' feature. I just remove it be it a pendrive or compact flash card. I've never experienced any problems, so I don't fully understand the usefulness of it.Exactly what I do. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
jftuga Posted November 7, 2006 Author Share Posted November 7, 2006 If write caching is turned on, then writes to a USB Key may not happen immediately. If you remove the key in an 'unsafe' way, all of your data may not have been flush to the disk that resides on the USB Key. -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
Lazycat Posted November 7, 2006 Share Posted November 7, 2006 I can't remember ever using the 'safely remove' feature. I just remove it be it a pendrive or compact flash card. I've never experienced any problems, so I don't fully understand the usefulness of it.You lucky, this is for the time being. Removing this without disconnecting may cause problems. Good, if this just one file, that remain in cache, but I know cases when in result filesystem was destroyed. For example, one my friend lost whole data on his stick, this even not formatting until using special recovery tool. So I'm prefer not be lazy in this case... Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Uten Posted November 7, 2006 Share Posted November 7, 2006 I try to always use it. And when explorer ain't your shell you can use this: rundll32.exe shell32.dll,Control_RunDLL hotplug.dll Works on w2k anyway would be nice to here if it works on XP to but I suppose it will. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
nitekram Posted November 7, 2006 Share Posted November 7, 2006 For those that are really lazy - try left clicking - a lot faster. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
jftuga Posted November 7, 2006 Author Share Posted November 7, 2006 rundll32.exe shell32.dll,Control_RunDLL hotplug.dllWorks on w2k anyway would be nice to here if it works on XP to but I suppose it will.Works on XP SP2, too! -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
nitekram Posted November 18, 2006 Share Posted November 18, 2006 For those that are really lazy - try left clicking - a lot faster.I reread this and it does not make sense, so I thought that I would explain - The icon that you click to go through all these screens, can be bypassed when you left click rather than right click on the icon. This is a short cut to closing the USB device, as it will show you a list of the devices connected. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
taurus905 Posted November 18, 2006 Share Posted November 18, 2006 I reread this and it does not make sense, so I thought that I would explain - The icon that you click to go through all these screens, can be bypassed when you left click rather than right click on the icon. This is a short cut to closing the USB device, as it will show you a list of the devices connected.nitekram,Thanks for the tip. I've always used the right-click and did not realize you could just left-click the icon.taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
nitekram Posted November 18, 2006 Share Posted November 18, 2006 nitekram,Thanks for the tip. I've always used the right-click and did not realize you could just left-click the icon.taurus905No problem - I found it a while back and used ever since. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now