Page 1 of 1

Unlocker w/ Sound

Posted: 17 Nov 2009 06:44
by stanmarsh
Unlocker, unlocks the file in use by another program or user. :D

Code: Select all

//Unlocker 0.1

"Unlock : unlock"
    //set Unlocker path below 
    $_exec = "<xypath>\Unlocker\UnlockerPortable.exe";
	openwith """$_exec"" <items>", m;
just a minor update to unlocker script, i use -s to hide the GUI and added a sound notification using microwav.

requirements:
program - http://bellsouthpwp2.net/b/o/bobad/microwav.htm by MacGyver_Soft
sound file - C:\WINDOWS\Media\chimes.wav
PFA - *.wav>microwav.exe

Code: Select all

//Unlocker 0.2
//-s: Unlock object without showing GUI

"Unlock : unlock"
    //set Unlocker and Sound path below 
    $_exec = "<xypath>\Unlocker\UnlockerPortable.exe";
	$_wav = "<xypath>\chimes.wav";
    
	openwith """$_exec"" <items> -s", m;
   open "$_wav";

Re: Unlocker

Posted: 17 Nov 2009 13:05
by ramza__x
Thank you!
Confirmed, it works!
(just tell the newbie to change the path)

Re: Unlocker

Posted: 17 Nov 2009 13:13
by zer0
Couple of questions:
a) Why are you defining the path variable as 'global'?
b) Why quote a path separately instead of a straight forward

Code: Select all

openwith """<xypath>\Unlocker\UnlockerPortable.exe"" <items>", m;
Don't get the impression that I'm knocking down your effort, simply curious :wink:

Re: Unlocker

Posted: 18 Nov 2009 02:26
by stanmarsh
hello zero,

thank you for the suggestion :) , your way is much better, i'm actually just learning how to script. i removed the global now and replaced it with a comment, and i separated the path because it looks much cleaner.

Re: Unlocker

Posted: 18 Nov 2009 10:58
by zer0
stanmarsh wrote:thank you for the suggestion :) , your way is much better, i'm actually just learning how to script. i removed the global now and replaced it with a comment, and i separated the path because it looks much cleaner.
Everyone has their habits when it comes to scripting. When you're learning, it's good to break things down, because that would provide an easier way to comprehend. If you get more serious with scripting/programming then you'd come across a concept called 'refactoring', aka tidying up the code, a result of which is that one-line script that I mentioned.

Always happy to help ;)