Ok, here it is, be aware the code is a bit of a mess.
I hope that the ones for which it didn't work have some clues for me so I can improve the script.
Also if someone has a ideas on how to increase the number of entries on the gui (after about 19 entries the gui gets to big) I welcome that very much.
All other suggestions for improvement are welcome ofcourse.
Code:
#SingleInstance force
#Persistent
version=1.4
TrayTip, klik2assist reload for %username%, Use WIN Z to log in on a website`n Use WIN A to add a new website,4,1
SetTimer, RemoveTrayTip, 2000
SetTimer, destroi, 300000
SetTitleMatchMode,2
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
logtxt=login/refresh
Menu, Tray, Click, 1
Menu, Tray, Add, klik2assist, add_db
Menu, Tray, Default, klik2assist
return
#a::
add_db:
;/////////////////gui verwijderen indien actief
ifwinexist, retrieve
{
return
}
gui, destroy
sleep, 300
;///////////////////uitlezen register om textfile op te sporen
RegRead, scriptA, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, pass
if scriptA <>
{
SplitPath, scriptA, PathName, PathDir
path = %PathDir%
}
else
{
path = %A_WorkingDir%
}
file = %username%-klik2assist.txt
;///////////////////////////////////gosub firefox
Title=Explorer
IfWinExist, %Title%
{
Winwait, Explorer
WinActivate, Explorer
http = http
ControlGetText, url, Edit1 , A
IfNotInString, url, %http%
ControlGetText, url, Edit2 , A
IfNotInString, url, %http%
ControlGetText, url, Edit3 , A
WinGetTitle, urllong, %Title%
StringGetPos, pos, urllong, - Microsoft Internet Explorer ,
StringLen,Length1,urllong
aftrek:=Length1-pos
;msgbox, %Length1% en afterk = %aftrek%
StringTrimRight, site1, urllong, %aftrek%
StringSplit, site, site1, [|(,
StringLen,Length,site1
if Length > 30
{
kort:=Length-30
;msgbox, %kort%
StringTrimRight, site1, site1, %kort%
}
sitenaam = %site1%
titel = Microsoft Explorer
kleur = CCFFFF
urlnaam = url website
af = IE
}
else IfWinExist, Mozilla Firefox
{
WinWait, Firefox
WinActivate, Firefox
gosub, firefox
}
t=1
Yw = 30
Gui, +resize
Gui, Color, %kleur%
pathfile = %path%\%file%
;/////////////////////////////////////uitlezen password file en gui opbouwen
Loop, read, %pathfile%
{
StringReplace, Newstring, A_loopreadline, %a_tab%, ``, All
stringsplit, regel, Newstring, ``
if A_loopreadline <>
{
if t=1
{
Gui, Add, Text, x66 y10 w70 cBlue , Website
Gui, Add, Text, x316 y10 w70 cBlue , Username
Gui, Add, Text, x516 y10 w70 cBlue , Password
}
Yw := t * 30
Nummer := %a_index% + 1
Gui, Add, Button, x10 y%Yw% h20 w30 gMyButtons v%A_Index%, Del
VarB%A_Index% = 0
Gui, Add, Button,x66 y%Yw% cGreen gKlik v%Linep% , %regel1%
Gui, Add, Button,x256 y%Yw% cGreen gUrl vT%A_index% , url
Gui, Add, text,x316 y%Yw% , %regel3%
Gui, Add, text,x516 y%Yw% , ******
t += 1
}
}
Y0 := Yw + 30
Y1 := Yw + 50
Y2 := Yw + 80
Y3 := Yw + 110
Y4 := Yw + 140
Y5 := Yw + 170
y6 := Yw + 200
Gui, font, bold,,
Gui, Add, Text, x16 y%y0% w400 h20, Add Website with account-login details
Gui, font, norm,,
Gui, Add, Text, x16 y%y1% w100 h20, name website
Gui, Add, Text, x16 y%y2% w300 h20, %urlnaam%
Gui, Add, Text, x16 y%y3% w100 h20, username
Gui, Add, Text, x16 y%y4% w80 h20, password
Gui, Add, Text, x116 y%y1% w200 h20, %sitenaam%
;Gui, Add, Text, x280 y%y1% w300 h20, Edit for own convenience
Gui, Add, Edit, x116 y%y2% w450 h20 vPar1, %url%
Gui, Add, Edit, x116 y%y3% w150 h20 vPar2,
Gui, Add, Edit, x116 y%y4% w100 h20 vPar3 Password,
Gui, Add, Button, x16 y%y5% w240 h40, Add
Gui, Show, x16 y20 w620, Klik2assist v%version% Add and retrieve login details for %titel%
App = %A_WorkingDir%\pass.exe
SplitPath, App, PathName, PathDir
RegRead, scriptA, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, pass
Gui, Add, Text, x300 y%y4% w250 cBlack, Load Klik2assist automaticaly with starting PC?
Gui, Font, underline
Yb:=y4-10
;If scriptA <>
;{
Gui, Add, Button, x570 y%yb% , No
Gui, Add, Button, x530 y%yb% , Yes
;}
;Gui, Add, Text, x400 y%y5% w357 cBlue gLaunchklik, %reclame2%
Gui, Font, norm
Gui, Add, Text, x300 y%y5% cPurple, Check our sponsor:
Gui, Font, underline
Gui, Add, Text, x445 y%y5% cBlue gLaunchklik,www.hydrogencell.org
Gui, Add, Text, x300 y%y6% w357 cRed gBelangrijk, Important !
;Gui, Add, Text, x460 y%y6% cBlue gDownload, klik2assist versie controle
return
Belangrijk:
Gui, Color, FBEF8F
Gui, 2:Add, Text,, This script creates a text-file in the same map as where klik2assist.exe rests `n In this file your login details are saved`n So after restarting windows you still have your login details nearby. `n The passwords are saved encrypted and can only be decrypted on your pc,`n but, in the end everything can be hacked. `nSo make sure you always use a good firewall and do not use this program for bussiness purposes.`n`nThe creators of this script are not liable for any damages that are the result of using this application.
Gui, 2:show, x16 y%y6% w520, Important remarks
return
Launchklik:
Run www.hydrogencell.org
return
Opstart:
Gui, 3:Color, FBEFF0
Gui, 3:Add, Text,,Klik2assist.exe is now saved to your register. This means that klik2assist will be active
Gui, 3:Add, Text,,everytime you startup windows and provides you direct access to your login-details.
Gui, 3:Add, Text,,When you change your mind and want to prevent that klik2assist is actiated automatically just click
Gui, 3:Add, Text,,the link: "Do not start script automatically with starting windows".
Gui, 3:Add, Text,,Curious where the program is saved to your register?
Gui, 3:Add, Text,,Go to start-->(run) type "regedit"
Gui, 3:Add, Text,,Navigate to: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
Gui, 3:Add, Text,,At "pass" you can find Klik2assist.exe.
Gui, 3:Add, Button, x400 w140 h20, Close
Gui, 3:show, x16 y300 w560, Load klik2assist automatically
return
ButtonYes:
App = %A_WorkingDir%\klik2assist.exe
IfExist, %App%
{
SplitPath, App, PathName, PathDir
RegWrite, REG_SZ, HKLM, Software\Microsoft\Windows\CurrentVersion\Run, pass, %App%
gosub,Opstart
}
return
ButtonNo:
RegDelete, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, pass
gosub, verwijder
return
Klik:
num = %A_GuiControl%
;msgbox, %num%
Loop, read, %pathfile%
{
StringReplace, Newstring, A_loopreadline, %a_tab%, ``, All
stringsplit, regel, Newstring, ``
if regel1 = %num%
{
dbvar2 = %regel2%
dbvar3 = %regel3%
dbvar4 = %regel4%
if dbvar2 = http://www.klik2match.nl/index.php
{
dbvar2 = http://www.klik2match.nl/index_a.php
}
}
}
run %dbvar2%
return
Url:
lineurl = %A_GuiControl%
line_url = %Lineurl%
Loop, read, %pathfile%
{
nr = T%a_index%
if nr = %line_url%
{
StringReplace, Newstring, A_loopreadline, %a_tab%, ``, All
stringsplit, regel, Newstring, ``
urltot = %regel2%
}
}
msgbox, %urltot%
return
MyButtons:
line = %A_GuiControl%
Gosub, ShowValues
return
ShowValues:
SetBatchLines, -1
line_to_delete = %Line%
Loop, read, %pathfile% , passtmp.txt
{
if a_index <> %line_to_delete%
FileAppend, %A_LoopReadLine%`n
}
FileMove, passtmp.txt, %pathfile%, 1
gui, destroy
goto, add_db
return
msgbox, Script will start automatically next time
goto, reload
return
verwijder:
Gui, 4:Color, FBEFF0
Gui, 4:Add, Text,,Klik2assist.exe will not load automatically next time when starting windows
Gui, 4:Add, Text,,You will have to load klik2assist manually from now on.
Gui, 4:Add, Button, x260 w140 h20, Close
Gui, 4:show, x16 y400 w400, Do not load klik2assist automatically
return
ButtonAdd:
Gui, submit
goto check_db
Gui, destroy
4ButtonSluiten:
3ButtonSluiten:
3GuiClose:
3GuiEscape:
goto, reload
return
GuiClose:
GuiEscape:
Gui, destroy
goto, reload
return
destroi:
;IfWinActive,Ahk_Class AutoHotkeyGUI
;{
;gui, destroy
;goto, add_db
;}
;else
reload
return
check_db:
if Par1=
{
msgbox, you did not enter a website name
goto add_db
}
notindb:
PW = %A_ComputerName%
Data = %Par3%
RegRead, scriptA, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, pass
if scriptA <>
{
SplitPath, scriptA, PathName, PathDir
path = %PathDir%
}
else
{
path = %A_WorkingDir%
}
pathfile = %path%\%file%
Loop, read, %pathfile%
{
stringsplit, dbvar, A_loopreadline, %a_tab%%a_tab%
if sitenaam = %dbvar1%
{
if Par2 = %dbvar3%
{
msgbox, This username is already present for %dbvar2%
goto, add_db
}
}
}
Gosub, RC4
FileAppend,`n%sitenaam%%a_tab%%Par1%%a_tab%%Par2%%a_tab%%Result%%a_tab%,%pathfile%
sleep, 200
goto, add_db
return
#z::
searchdb:
file = %username%-klik2assist.txt
Title=Mozilla Firefox
url =
;dbvar3 =
SetTitleMatchMode,2
;////////////////////////////////////indien vanuit gui geklikt
if dbvar2 <>
goto invullen
;//////////////////////////////////////////////////////////////explorer
IfWinActive, ahk_class IEFrame
explor = 1
IfWinActive, ahk_class CabinetWClass
explor = 1
http = http
if explor = 1
gosub, explorer
else IfWinActive, %Title%
{
gosub, fire
}
RegRead, scriptA, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, pass
if scriptA <>
{
SplitPath, scriptA, PathName, PathDir
path = %PathDir%
}
else
{
path = %A_WorkingDir%
}
pathfile = %path%\%file%
findurl = 0
findsite = 0
Loop, read, %pathfile%
{
StringReplace, Newstring, A_loopreadline, %a_tab%, ``, All
stringsplit, dbvar, Newstring, ``
dbvar1 = %dbvar1%
sitetitel = %sitetitel%
if A_LoopReadLine <>
{
ifequal,dbvar2,%url%
{
findurl += 1
site%findurl%:= dbvar2
user%findurl%:= dbvar3
pass%findurl%:= dbvar4
}
;msgbox, %dbvar1%
;msgbox,"%sitenaam%"uit bestand
ifequal,dbvar1,%sitenaam%
{
findsite += 1
site%findsite%:= dbvar2
user%findsite%:= dbvar3
pass%findsite%:= dbvar4
}
}
}
if findsite = 0
{
if findurl = 0
{
gosub, #A
return
}
}
if findurl = 1
{
dbvar3 = %user1%
dbvar4 = %pass1%
goto, invullen
}
else if findsite = 1
{
dbvar3 = %user1%
dbvar4 = %pass1%
goto, invullen
}
else
{
if findurl > 1
loop = %findurl%
else if findsite > 1
loop = %findsite%
meerdere:
gui, destroy
Gui, 5:Color, FBEFF0
w=0
loop,%loop%
{
w += 1
Yg := w * 30
sitek:=site%w%
userk:=user%w%
passw:=pass%w%
if w = 1
{
StringLen,Lengtelaatst,site1
;msgbox, %Lengtelaatst%
}
StringLen,Lengte,sitek
breed := (Lengtelaatst * 4) + 300
;msgbox, %breed%
if Lengte > %lengtelaatst%
{
breed := (Lengte * 4) + 300
lengtelaatst = %Lengte%
}
Gui, 5:Add, Button, x10 y%Yg% h20 gKiest v%A_Index%, login
Gui, 5:Add, Text, x110 y%Yg% , %userk%
Gui, 5:Add, Text, x200 y%Yg% , %sitek%
}
Gui, 5:show,x100 y200 w%breed%, Which login do you mean?
return
}
5GuiClose:
5GuiEscape:
goto, reload
return
Kiest:
Gui, submit
keuze = %A_GuiControl%
StringTrimLeft, dbvar3, user%keuze%, 0
StringTrimLeft, dbvar4, pass%keuze%, 0
;msgbox, %naam%
Gui, destroy
goto invullen
return
;msgbox, %find%
goto invullen
if dbvar3 =
{
goto, add_db
}
invullen:
ATrim = %A_AutoTrim%
AutoTrim, Off
BLines = %A_BatchLines%
SetBatchlines, -1
StringLen, PWLen, PW
PW = %A_ComputerName%
Data = %dbvar4%
Gosub, RC4
send, %dbvar3%
sleep, 200
send, {tab}
send, {home}
send, {shiftdown}
sleep, 200
send,{end}
send,{shiftup}
sleep, 200
send, {delete}
sleep, 200
send, %Result%
dbvar1 =
dbvar2 =
dbvar3 =
result =
return
firefox:
url =
Loop, 2
{
Send, {F6}
ControlGetFocus, CurrentFocus, A
If CurrentFocus = MozillaWindowClass1
send, {ctrldown}c{ctrlup}
url = %clipboard%
}
fire:
Title=Mozilla Firefox
WinGetTitle, urllong, %Title%
StringGetPos, pos, urllong, - Mozilla Firefox ,
StringLen,Length1,urllong
aftrek:=Length1-pos
;msgbox, %Length1% en afterk = %aftrek%
StringTrimRight, site1, urllong, %aftrek%
StringLen,Length,site1
if Length > 30
{
kort:=Length-30
StringTrimRight, site1, site1, %kort%
}
sitenaam = %site1%
; sitenaam = %site%
titel = Mozilla Firefox
kleur = FFCC99
urlnaam = titel website
af = FF
return
explorer:
Title=Explorer
IfWinExist, %Title%
{
Winwait, Explorer
WinActivate, Explorer
http = http
ControlGetText, url, Edit1 , A
IfNotInString, url, %http%
ControlGetText, url, Edit2 , A
IfNotInString, url, %http%
ControlGetText, url, Edit3 , A
WinGetTitle, urllong, %Title%
StringGetPos, pos, urllong, - Microsoft Internet Explorer ,
StringLen,Length1,urllong
aftrek:=Length1-pos
;msgbox, %Length1% en afterk = %aftrek%
StringTrimRight, site1, urllong, %aftrek%
StringSplit, site, site1, [|(,
StringLen,Length,site1
if Length > 30
{
kort:=Length-30
;msgbox, %kort%
StringTrimRight, site1, site1, %kort%
}
sitenaam = %site1%
titel = Microsoft Explorer
kleur = CCFFFF
urlnaam = url website
af = IE
}
return
^!r::
reload:
reload
RETURN