Capacitor powered LED flashlight

Long time ago QVC sold a shakeable Flashlight that had no batteries just a shakeable generator and a super capacitor. This flashlight uses a 5vdc 1.5a wall wart to charge the capacitors.

To figure out how long it will take to charge the flashlight you use this equation

$$T=5R_{currentlimit}C$$

And for total discharge time

$$T=5R_{LED}C$$

Where

T is time in seconds

Rcurrentlimit is the power resistor used in charging the capacitors in ohms

RLED is the LED resistor in ohms

C is total capacitance in farads

One thing you should know if the capacitors voltage is lower than the supply voltage you should put capacitors in series to increase the voltage rating on the capacitors. Usually you should use 2 capacitors in series and the supply voltage should be no more than capacitors voltage times 2. The diode will drop the voltage by some and also prevent discharging it threw the wall wart

https://youtu.be/aEMwYkuUkbI
YouTube video of this project

Yet another TV oscilloscope

In this blog post a crt TV a part and turn it into a oscilloscope. I am going to try to use a TL082 op amp to buffer and amplify the signal. It uses the deflection yoke to draw the picture on the tube.

More pictures and videos will be posted here when it is finished

DIY Static wrist strap

This wrist strap prevents electrostatic discharge to whatever you touch

What you need:

  • 1 meg ohm resistor(any wattage or tolerance will do
  • Copper tape or foil
  • a piece of wire(you can use all of the wires from a btoken cord if you like0
  • bracelet(This should allow the copper tape to stick)
  • one alligator clip

Step 1 cover the whole bracelet with copper tape

Step 2 solder a piece of wire to the copper tape. Do not solder the resistor to the tape. By doing that the connection will be bridal and break off.

Step 3 take the resistor and solder it to the wire which connects to bracelet

Step 4 solder another wire to the resistor to the ground clip, again don’t solder the resistor directly to the ground clip, it could break off.

Step 5 measure the meter in a range that is in greater than 1 meg ohm to see if it measures 1 meg ohm. If it does than your all done

Pictures coming soon

If you would like to see the DIY mat click here

DIY anti-static mat

This is a very simple esd mat that anyone can build.

All you need is

  • Small nail
  • Cardboard box
  • A three prong cord(must be three prong so that it functions correctly)
  • Copper foil sheets that stick(i got mine from eBay, it is used for guitars)
  • 1 meg ohm resistor any wattage should do.
  • Hot glue gun and sticks
  • Solder and soldering iron

First take the cardboard box and flatten it.

Next take your copper foil and try to cover the cardboard to the size you want your mat just leave some cardboard exposed for resistor and nail.

Next solder the 1 meg resistors to the copper and ground on the power cord(the green wire only) and don’t shorten the leads of the resistor yet, poke a hole for the nail to go though and wrap the resistor lead that is directly to the ground(this is where your wrist strap connects)

Hot glue the green wire to the cardboard so the resistor doesn’t break off.

My homemade esd mar

To make your own wrist strap click here.

Simplest analog computer

In this post I will show you how to make a analog computer using just resistors, switches and a 100 micro ammeter.

Here’s the schematic of it:

Schematic

You can see the idea on how this analog computer works, it uses ohms law to get current from resistors in the circuits. Each current is limited in binary. Also parallel resistance makes the current add up. This circuit can make current from 0 to 300 micro amps. This circuit can last for days on batteries. A 8 volt regulator should be used so the voltage stays at 8 volts.

So you might be thinking how can this analog computer add and subtract numbers?

First of all we need to know ohm’s law. Ohm’s law states that if we know 2 out of 3 variables(voltage,current or resistance) we can solve for the variable that we don’t know.

$$R=\frac{V}{I}$$

$$I=\frac{V}{R}$$

$$V=IR$$

V is input voltage I is current and R is resistance

So if we want 80 micro amps and our input voltage is 8v

$$R=\frac{8}{0.00008}=100k$$

Now the next thing is to know series and parallel resistance.

When resistors are in series the current lowers and resistance adds up.

$$R=R_{1}+R_{2}+R_{3}$$

in parallel the currents add up resistance goes down.

$$R=\frac{1}{\frac{1}{R_{1}}+\frac{1}{R_{2}}+\frac{1}{R_{3}}}$$

Next we calculate the resistance that is needed to generate 10,20,40 and 80 micro amps

$$R=\frac{8}{0.00001}=800k$$

$$R=\frac{8}{0.00002}=400k$$

$$R=\frac{8}{0.00004}=200k$$

$$R=\frac{8}{0.00008}=100k$$

To subtract do the second equation by trying all possible values for A

$$A=B-C$$

$$C=A+B$$

Once I get all of the parts I will update this post

Icon Screensaver

This screensaver does exactly what the name says. It looks for icons and have them bounce around the screen and leaving a trail behind them. They are randomly chosen from windows, system and cursors directory. It uses ExtractIcon function from shell32.dll to get the icon and number of icons.

unit iconscrnUnit1;
{$RESOURCE iconscreensaver.res}
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, shellapi,
  ExtCtrls, Menus;
const format_dword='%u';
switch_s='/s';
switch_p='/p';
appname='Icon Screensaver';
icontypes:array[0..6]of string=('exe','dll','cpl','scr','ico','ani','cur');
type
  TScrnSave =class(TForm)
    Timer1: TTimer;
    Timer2: TTimer;
    Timer3: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure Timer3Timer(Sender: TObject);
  private
    { Private declarations }
  public
  Movement,OldMouse,IconPos:tpoint;
  PreviewRect:TRect;
    { Public declarations }
  end;
var
  IconFiles:tstringlist;
  SelIcon:hicon;
  ScrnSave: TScrnSave;
implementation

{$R *.DFM}

procedure findIcons(const dir:string);
var i:integer;
sr:tsearchrec;
begin
for i:=0to high(icontypes)do
if findfirst(dir+'\*.'+icontypes[i],faanyfile,sr)=0then begin
iconfiles.Append(sr.name);
while findnext(sr)=0do iconfiles.Append(sr.name);
findclose(sr);
end;
end;

procedure TScrnSave.FormCreate(Sender: TObject);
var searchdir:array[0..max_path]of char;
about:msgboxparams;
begin
iconfiles:=tstringlist.Create;
movement.x:=10;
movement.y:=10;
if comparetext(paramstr(1),switch_p)=0then
begin//checks to see if it is being previewed in control panel
windows.GetClientRect(strtoint(paramstr(2)),previewrect);
clientheight:=previewrect.Bottom;
clientwidth:=previewrect.Right;
zeromemory(@previewrect.topleft,sizeof(tpoint));
windows.SetParent(handle,strtoint(paramstr(2)));
end else
if comparetext(switch_s,paramstr(1))<>0then
begin
zeromemory(@about,sizeof(About));
about.cbSize:=sizeof(about);
about.hInstance:=hinstance;
about.lpszText:=
'delphijustin Icon Screensaver v1.0'#13#10'By Justin Roeder'#13#10'2021';
about.lpszCaption:='About';
about.dwStyle:=mb_usericon;
about.lpszIcon:='MAINICON';
messageboxindirect(about);
exitprocess(0);
end;
getwindowsdirectory(searchdir,max_path);
findicons(searchdir);
findicons(strcat(searchdir,'\Cursors'));
getsystemdirectory(searchdir,max_path);
findicons(searchdir);
randomize;
iconpos.y:=random(clientheight);
iconpos.x:=random(clientwidth);
getcursorpos(oldmouse);
timer1.Enabled:=true;
timer2timer(nil);
timer3timer(nil);
timer2.Enabled:=true;
end;

procedure TScrnSave.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if comparetext(switch_p,paramstr(1))=0then exit;
close;
end;

procedure TScrnSave.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if comparetext(switch_p,paramstr(1))=0then exit;
close;
end;

procedure TScrnSave.Timer1Timer(Sender: TObject);
//This function draws the icons and checks for mouse movements
var newmouse:tpoint;
begin
if comparetext(switch_p,paramstr(1))=0then
if not iswindow(strtoint(paramstr(2)))then exitprocess(0);
getcursorpos(newmouse);
if(comparetext(switch_p,paramstr(1))<>0)and((newmouse.x<>oldmouse.x)or(newmouse.y<>oldmouse.y))then close;
with iconpos do
begin
y:=y+movement.y;
x:=x+movement.x;
drawicon(canvas.handle,x,y,selIcon);
if (y>clientheight)or(y<0) then movement.y:=-movement.y;
if (x>ClientWidth)OR(x<0) then movement.x:=-movement.x;
end;
end;

procedure TScrnSave.Timer2Timer(Sender: TObject);
var index,count:integer;
label tryagain;
begin
tryagain:index:=random(iconfiles.Count);
count:=extracticon(hinstance,pchar(iconfiles[index]),UINT(-1));
if COUNT=0then begin
iconfiles.Delete(index);goto tryagain; end;
if selicon<>0then destroyicon(selicon);
selicon:=extracticon(hinstance,pchar(iconfiles[index]),random(count));
end;

procedure TScrnSave.Timer3Timer(Sender: TObject);
begin
color:=rgb(random(256),random(256),random(256));
end;

end.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

Random Screensaver for windows

This screensaver randomly chooses screensavers when it starts. You can choose which folders to use, how long of a delay between screensavers and which ones you don’t want running.

Screensaver settings screenshot
program randomss;
{$RESOURCE RANDOMSCREENSAVER.RES}
(*
  This is the main file for random screensaver
  it starts the configuration window (TScreenSaverConfig)
  it starts choosing screensavers.
*)
uses
  SysUtils,
  windows,
  Classes,
  filectrl,
  forms,
  graphics,
  shellapi,
  randomssUnit1 in 'randomssUnit1.pas' {ScreenSaverConfig};
{$E scr}
label nextscr;
const RUNNING_HINT:pchar='Delete this key to allow the screensaver to run again';
type
TGetProcessId=function(handle:THandle):DWord;stdcall;
//The function GetProcessId wasn't defined in Delphi 4
var
hkRunning:hkey;
screc,scrpid:dword;
I:integer;
used:tstringlist;
exec:shellexecuteinfo;
preview:TCanvas;
GetProcessId:tgetprocessid;
previewRect:TRect;
randomized:boolean;
dir:array[0..max_path]of char;
Icon:TIcon;

function AlreadyRunning:boolean;
var disp,pid:dword;
hkrunning:hkey;
begin
disp:=maxdword;
pid:=getcurrentprocessid;
regcreatekeyex(hkey_current_user,reg_running,0,nil,reg_option_volatile,key_write,
nil,hkrunning,@disp);regsetvalueex(hkrunning,nil,0,reg_sz,running_hint,(1+strlen(
running_hint))*sizeof(char));
result:=(disp=reg_opened_existing_key);
if not result then regsetvalueex(hkrunning,reg_processid,0,reg_dword,@pid,4);
regclosekey(hkrunning);
end;

begin
randomize;
regcreatekeyex(hkey_current_user,'Software\Justin\RandomSCR',0,nil,
reg_option_non_volatile,key_all_access,nil,hkapp,nil);
bRunOnce:=(regqueryvalueex(hkapp,reg_norunonce,nil,nil,nil,nil)<>error_success);
rs:=4;
bnoshuffle:=(regqueryvalueeX(hkapp,reg_randomseed,nil,nil,@randseed,@rs)=error_success);
rs:=4;
getwindowsdirectory(windir,max_path);
maxtime:=60000;
regqueryvalueex(hkapp,reg_runtime,nil,nil,@maxtime,@rs);
randomized:=(maxtime=random_time);
rs:=sizeof(szExcluded);
regqueryvalueeX(hkapp,reg_excluded,nil,nil,Pointer(strcopy(szexcluded,'')),@rs);
excluded:=tstringlist.Create;
excluded.CommaText:=strpas(szexcluded);
excluded.Append(paramstr(0));
directories:=tstringlist.create;
rs:=sizeof(szdirectories);
directories.Append(windir);//for windows 9x/Me(Even though  this tool won't work with that OS)
if directoryexists(strfmt(dir,'%s\system32',[windir]))then directories.Append(
dir);//for NT-type screensavers
if directoryexists(strfmt(dir,'%s\SysWOW64',[windir]))then directories.Append(
dir);//for 64-bit windows
if directoryexists(strfmt(dir,'%s\system',[windir]))then directories.Append(dir);
//just in case there screensavers in that folder
regqueryvalueex(hkapp,reg_dirlist,nil,nil,pointer(strplcopy(szDirectories,
directories.commatext,1024)),@rs);
directories.commatext:=strpas(szdirectories);
screensavers:=tstringlist.Create;
for i:=0to directories.count-1do begin
if findfirst(format('%s\*.scr',[directories[i]]),faanyfile,findscr)=0then begin
if(excluded.IndexOf(findscr.finddata.cfilename)=-1)and(-1=excluded.Indexof(
extractfilename(findscr.FindData.cFileName))) then
screensavers.Append(Directories[i]+'\'+findscr.FindData.cFileName);
while findnext(findscr)=0do
if(excluded.IndexOf(findscr.finddata.cfilename)=-1)and(-1=excluded.Indexof(
extractfilename(findscr.FindData.cFileName))) then
screensavers.Append(directories[i]+'\'+findscr.FindData.cFileName);
sysutils.FindClose(findscR);
end;
end;
if(comparetext('/p',paramstr(1))<>0)and(comparetext(paramstr(1),'/s')<>0)and(
comparetext('/debug',paramstr(1))<>0)then
begin(* This code is executed when the Settings button has been clicked or
        Configure has been choosen from the file menu *)
application.Initialize;
Application.CreateForm(Tscreensaverconfig, screensaverconfig);
application.Run;
exitprocess(0);
end;
regclosekey(hkapp);
if comparetext('/p',paramstr(1))=0then
begin(* executes this code when being previewed in control panel *)
icon:=ticon.Create;
icon.Handle:=loadicon(hinstance,MakeIntResource(1));
preview:=tcanvas.Create;
preview.Handle:=getwindowdc(strtoint(paramstr(2)));
getclientrect(strtoint(paramstr(2)),previewrect);
while iswindow(strtoint(paramstr(2)))do
begin
for I:=0to high(randomss_about)do
preview.TextOut(0,i*16,randomss_about[i]);
with previewrect.BottomRight do
preview.Draw(x div 2,y div 2,icon);//draw the icon in the middle of the preview window
sleep(100);
end;
releasedc(strtoint(paramstr(2)),preview.handle);
exitprocess(0);
 end;
 if alreadyrunning then exitprocess(wait_timeout);
 //Don't allow more than one process of this screensaver running.
 @GetProcessId:=getprocaddress(getmodulehandle(kernel32),'GetProcessId');
 zeromemory(@exec,sizeof(exec));
exec.cbSize:=sizeof(exec);
exec.fMask:=see_mask_nocloseprocess;
exec.lpFile:=stralloc(MAX_PATH+1);
exec.lpParameters:='/S';
exec.nShow:=sw_show;
if screensavers.Count=0then begin messagebox(0,'No screensavers found',appname,
mb_iconwarning);exitprocess(error_file_not_found);end;
used:=tstringlist.Create;
(* Starts choosing screensavers *)
regopenkeyex(hkey_current_user,reg_running,0,key_all_access,hkrunning);
(*Assumes that the key "HKEY_CURRENT_USER\Software\Justin\RandomSCR\Running" exists
  or created by the alreadyrunning function *)
nextscr:if randomized then maxtime:=60000+random(15*60000);
if used.Count=screensavers.Count then used.Clear;
if(used.IndexOf(strpcopy(exec.lpFile,screensavers[random(screensavers.count)]))>-1)
then goto nextscr;
if brunonce then used.Append(exec.lpFile);
if not shellexecuteex(@Exec) then(* Use ShellExecuteEx to start the screensaver *)
begin regclosekey(hkrunning);exitprocess(1);end;
if assigned(getprocessid)then scrpid:=getprocessid(exec.hProcess);
regsetvalueex(hkrunning,reg_scrpid,0,reg_dword,@scrpid,4);
case waitforsingleobject(exec.hProcess,maxtime)of(* wait for timeout or screensaver exit *)
wait_timeout:begin terminateprocess(exec.hProcess,0);closehandle(exec.hProcess);
goto nextscr; end;
wait_failed:messagebox(0,pchar('WaitForScreensaver: '+syserrormessage(
getlasterror)),exec.lpfile,mb_iconwarning);
else screc:=0;getexitcodeprocess(exec.hprocess,screc);terminateprocess(
exec.hProcess,0);closehandle(exec.hProcess);if screc=wait_timeout then
goto nextscr;
end;
if hkrunning<>0then regclosekey(hkrunning);
regdeletekey(hkey_current_user,reg_running);
exitprocess(getlasterror);
end.

unit randomssUnit1;
(*
  Settings form unit.
*)
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Menus, ComCtrls;
const appname='Random Screensaver';
REG_RUNNING='Software\Justin\RandomSCR\Running';
reg_runtime='RunTime';
reg_excluded='Excluded';
reg_processid='ProcessID';
reg_scrpid='SCRProcessID';
random_time=maxdword-1;
RandomSS_About:Array[0..2]of string=(
'delphijustin Random ScreenSaver v1.0',
'By Justin Roeder','2021');
reg_dirlist='Directories';
reg_randomseed='RandomSeed';
reg_NoRunOnce='NoRunOnce';
type
EBadTimeout=class(Exception)
end;
  TScreenSaverConfig = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    Button1: TButton;
    MainMenu1: TMainMenu;
    Help1: TMenuItem;
    About1: TMenuItem;
    Button2: TButton;
    Label3: TLabel;
    Memo2: TMemo;
    Button3: TButton;
    OpenDialog1: TOpenDialog;
    CheckBox1: TCheckBox;
    Label4: TLabel;
    StatusBar1: TStatusBar;
    ComboBox1: TComboBox;
    CheckBox2: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure About1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
function StrToTimeout(const s:string):dword;
var
  ScreenSaverConfig: TScreenSaverConfig;
  bRunOnce,bNoShuffle:boolean;
maxTime,rs:dword;
ScreenSavers,excluded,directories:Tstringlist;
findscr:tsearchrec;
windir:array[0..max_path]of char;
szdirectories,szExcluded:array[0..1024]of char;
hkApp:hkey;
implementation

{$R *.DFM}

function TimeoutToStr(timeout:dword):string;
begin
case timeout of //Converts the timeout(in milliseconds)to a readable string
infinite:result:='INF';
RANDOM_TIME:result:='RANDOM';
ELSE result:=formatdatetime('hh:mm:ss',timeout*EncodeTime(0,0,0,1));
END;
end;

function StrToTimeout(const s:string):dword;
begin
try//does the opposite of TimeoutToStr
if comparetext(s,'INF')=0then result:=infinite else
if comparetext(s,'RANDOM')=0Then result:=random_time else
result:=round(strtotime(s)/encodetime(0,0,0,1));
if(result<60000)then
raise EBadTimeout.Create(
'To prevent system crashes, the time cannot be less than 1 minute');
except on E:EConvertError do result:=60000;end;
end;

procedure TScreenSaverConfig.FormCreate(Sender: TObject);
begin//initializes the configuration form.
regdeletekey(hkey_current_user,reg_running);
with excluded do delete(indexof(paramstr(0)));
icon.Handle:=loadicon(hinstance,makeintresource(1));
application.Icon.Handle:=icon.Handle;
application.Title:=caption;
opendialog1.InitialDir:=strpas(windir);
checkbox1.Checked:=brunonce;
checkbox2.Checked:=bNoShuffle;
combobox1.Text:=timeouttostr(maxtime);
memo1.Text:=directories.Text;
memo2.Text:=excluded.text;
statusbar1.SimpleText:=format(statusbar1.SimpleText,[screensavers.count]);

end;

procedure TScreenSaverConfig.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
regclosekey(hkapp);
exitprocess(0);
end;

procedure TScreenSaverConfig.About1Click(Sender: TObject);
var msgbox:msgboxparams;
I:integer;
begin
zeromemory(@msgbox,sizeof(msgboX));
msgbox.cbSize:=sizeof(msgbox);
msgbox.hwndOwner:=handle;
msgbox.hInstance:=hinstance;
msgbox.lpszText:=strcopy(stralloc(2048),'');
for I:=0to high(randomss_about)do
strpcopy(strend(msgbox.lpsztext),randomss_about[i]+#13#10);
msgbox.lpszCaption:='About';
msgbox.dwStyle:=mb_usericon;
msgbox.lpszIcon:=makeintresource(1);
messageboxindirect(msgbox);
strdispose(msgbox.lpszText);
end;

procedure TScreenSaverConfig.Button1Click(Sender: TObject);
begin
(* Saves settings in the registry under the following key:
   HKEY_CURRENT_USER\Software\Justin\RandomSCR
   NoRunOnce         If exists the screensaver list wont act like a deck of cards.
   Excluded          Comma seperated list of screensavers to not run.
   Directories       Comma seperated list of screensaver directories
   RandomSeed        If exists the list won't be shuffled and its seed is initialed by that value.
   RunTime           Timeout in milliseconds or one of the following values:
                     0xFFFFFFFF Unlimited time
                     0xFFFFFFFE Random time in between(1 and 15 minutes)
*)
if checkbox1.Checked then regdeletevalue(hkapp,reg_norunonce)else
regsetvalueex(hkapp,reg_norunonce,0,reg_binary,nil,0);
maxtime:=strtotimeout(combobox1.text);
with memo2.Lines do
regsetvalueex(hkapp,reg_excluded,0,reg_sz,strpcopy(szExcluded,commatext),(1+
length(commatext))*sizeof(chaR));
regsetvalueex(hkapp,reg_runtime,0,reg_dword,@maxtime,4);
with memo1.Lines do
regsetvalueex(hkapp,reg_dirlist,0,reg_sz,strpcopy(szdirectories,commatext),(1+
length(commatext))*sizeof(char));
if checkbox2.Checked then regsetvalueex(hkapp,reg_randomseed,0,reg_dword,
@randseed,4)else regdeletevalue(hkapp,reg_randomseed);
close;
end;

procedure TScreenSaverConfig.Button2Click(Sender: TObject);
begin
close;
end;

procedure TScreenSaverConfig.Button3Click(Sender: TObject);
begin
(* Exclude list browse button *)
if not opendialog1.Execute then exit;
memo2.Lines.Add(extractfilename(opendialog1.filename));
end;

end.

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

AutoRecord for NCH SoundTap

I wanted soundtap to keep recording after a song was done playing on YouTube so thus AutoRecord tool was made

All programs are virus free. Some antivirus software might say its "suspicious" or a "Potentionaly Unwanted Program". Some of them rate them on what there code looks like no matter if theres a definition in the virus database. If any of them are detected any Antivirus I will zip the software with the password "justin" j is lowercase

program autorec;
(*
This code is very simple. It enumerates all window handles to find the button
with classname "Button" and window text "Start Recording" if it doesnt find it
at the first attempt it will open soundtap and try again. After all of that it
looks to see if the window text not equals "Stop Recording" once that is true
it will send a BM_CLICK message to that button and then repeats that process
until the button handle is no longer valid.
*)
{$apptype console}
{$Resource autorec-data.res}
uses
  SysUtils,messages,
  windows,shellapi;

var RecordBTN:hwnd;
seError:hinst;
rs:dword;
recordcap:array[0..255]of char;
hk:hkey;
soundtap_exe:array[0..max_path]of char;
function findbutton(hw:hwnd;lp:lparam):bool;stdcall;
var classn,wndtext:array[0..255]of char;
begin
result:=true;
getclassname(hw,classn,255);
getwindowtext(hw,wndtext,255);
if(comparetext(wndtext,'Start Recording')=0)and(comparetext(classn,'Button')=0)
then begin recordbtn:=hw;result:=false;exit;end;
//enumchildwindows(hw,@findbutton,1);
end;
procedure buttonClicked(hw:hwnd;umsg:uint;dwdata:dword;lresult:lresult);stdcall;
asm
nop
end;

begin
recordbtn:=getdesktopwindow;
writeln('delphijustin Autorecord for soundtap v1.0');
writeln('Not created by NCH Software');
writeln('Searching for record button...');
enumchildwindows(getdesktopwindow,@findbutton,0);
if recordbtn=getdesktopwindow then begin
//if first attept fails try launching SoundTap
regopenkeyex(HKEY_LOCAL_MACHINE,'SOFTWARE\NCH Software\SoundTap\Settings',0,
key_read,hk);//Open soundtap registry key and query install path
rs:=sizeof(soundtap_exe);
if regqueryvalueex(hk,'InstallerPath',nil,nil,@soundtap_exe,@rs)<>error_success
then begin writeln('Could not find SoundTap');regclosekey(hk);exitprocess(1);
end;//end if regqueryvalueex
regclosekey(hk);seError:=shellexecute(0,nil,strcat(soundtap_exe,'\soundtap.exe'),
nil,nil,sw_shownormal);if seerror<33then begin writeln(soundtap_exe,':',
syserrormessage(seerror));exitprocess(1);end;//end if seerror
sleep(10000);
//give about 10 seconds for soundtap to finsh loading
enumchildwindows(getdesktopwindow,@findbutton,0);//attempt to find the button one last time
if recordbtn=getdesktopwindow then begin writeln('Cannot find the record button');
exitprocess(1);
end;//end if second attempt
end;//end if first attempt
writeln('Button found. Handle is 0x',inttohex(recordbtn,0));
while iswindow(recordbtn)do begin//check window text until the button is no longer valid
sleep(5000);
getwindowtext(recordbtn,recordcap,255);
if comparetext('Stop Recording',recordcap)<>0then
sendmessagecallback(recordbtn,bm_click,0,0,@buttonclicked,0);
//so far SendMessageCallback is the only method
end;
writeln('Button handle no longer valid');
end.
delphijustin Industries is an Autism Supported Business
Social Media Auto Publish Powered By : XYZScripts.com
All in one
Start
Amazon.com, Inc. OH Dublin
Your cart is empty.
Loading...