chip642 | Дата: Пятница, 14.08.2020, 06:02 | Сообщение № 6 |
|
goldenge, у меня посвежее Associations.vbs, протестируйте.
Код ' Associations.vbs '======================= Описание ====================================== ' Ассоциация типов файлов с AkelPad '======================= Параметр ======================================= ' 1-й и 2-й параметр: ' - "0" "txt,ini,inf" - ассоциируется расширения, прописанные в строке через запятую ' - "1" "%f" - ассоциируется расширение текущего файла ' - "2" "" - ассоциируется расширения, прописанные в диалоге через запятую ' Любой 3-й параметр означает, что значки для типов будут взяты из библиотеки AkelExtImage.dll
' расширения bat;cmd;vbs;js;hta;reg;sys;au3;ahk;a3x - не ассоциируются, но можно присвоить им значок из библиотеки, используя 3-й параметр: ' используется Functions.vbs, который следует положить в ...AkelFiles\Plugs\Scripts\Include\ ' используется TCIMG.exe
' Автор: Аверин Андрей ' Версия: 1.8 (11.08.2012 - 24.04.2016) ' Mail: Averin-And@yandex.ru ' Site: http://tc-image.3dn.ru/forum/9-603-5938-16-1365323449 '==================== Изменяемые пути ================================== IcoDll = "\AkelExtImage.dll" ' библиотека значков для типов файлов '=========================================================================== P = -1 : Titles = "Ассоциация типов файлов" With WScript Cnt = .Arguments.Count If Cnt < 2 Then WScript.Quit P = .Arguments(0) : List = .Arguments(1) End With Select Case List Case "#" List = "tll,tcinfo,$$$,1st,AES-crypt,a3x,ac~,ahk,akelmenu,au3,autocomplete,ax~,b64,back,bak,bar,bat,bck,bkp,browse,cmd,cnf,cnfp,cn~,coder,conf,config,co~,cp~,crypt,da~,dl~,dr~,ex~,footer,gdb,gjlog,h,hhc,hhk,hhp,hta,htm,html,ie~,inc,ini,input,java,js,lang,list,lng,log,lsl,lst,lua,m3u,m3u8,main,manifest,me,mht,mnu,mosaic,nsm,oc~,old,org,param,pas,pec2bac,pk,pl,playlist,pls,pm,py,pyc,reg,ru,rus,russian,sc~,sout,swp,sys,tab,tcg,tch,tci,tcm,temp,tmp,toolbar,txt,url,uue,vbs,vlm,wbk,wpl,wsc,wsf,xxe" End Select With AkelPad .Include("Functions.vbs") : AP = GetExeAkel : MAkel = .GetFilePath(AP, 3) TCIMG = GetPath(ReadOption("IMAGE", "TCIMG", 3)) ' путь к TCIMG.exe, берётся из AkelPadImage.ini A = .GetAkelDir(0) : AP = Replace(AP, "\", "\\") : RP = A & "\AkelFiles\Regs\" : ICL = A & IcoDll If Not FFExists(RP, 2) Then CreateFolderInPath(RP) NoExt = ";a3x;ahk;au3;bat;cmd;gdb;hta;htm;html;js;mht;reg;sys;url;vbs;" Select Case P Case 0 Call CheckExt(List) Case 1 Call CheckExt(LCase(.GetFilePath(List, 4))) Case 2 List = InputBox("Введите расширения, которые хотите ассоциировать с AkelPad (через запятую)", Titles, "txt,ini,inf") If Len(List) = 0 Or IsEmpty(List) Then WScript.Quit Call CheckExt(List) End Select CreateObject("WScript.Shell").Popup "Ассоциирование завершено!", 3, Titles, 64 End With
Sub CheckExt(Line) ar = Split(Line, ",") LenArr = Ubound(ar) If LenArr > 2 Then RunTCIMG "prgrs=x||Ассоциация типов файлов|Ассоциировано расширение ...|5|5|250|75", False For i = 0 To LenArr EL = LCase(ar(i)) If Len(EL) > 0 Then If InStr(NoExt, ";" & EL & ";") = 0 Then CreateRegTextProg EL Else If Cnt > 2 Then If Not FFExists(ICL, 1) Then WScript.Quit CreateRegTextIcon EL Else WScript.Quit End If End If If LenArr > 2 Then RunTCIMG "prgrs=" & i & "|" & LenArr & "||Ассоциировано расширение " & EL, True End If Next RunTCIMG "prgrs=-1", False End Sub
Sub CreateRegTextProg(IExt) If Cnt > 2 Then Icon = "@=""" & Replace(ICL, "\", "\\") & "," & GetIcon(IExt) & """" Else Icon = "@=""" & AP & ",0""" End If F = IExt & "file" : H = "[HKEY_CLASSES_ROOT\" Reg = "Windows Registry Editor Version 5.00" & vb2 &_ H & "." & IExt & "]" & vb & "@=""" & F & """" & vb2 &_ H & F & "]" & vb2 &_ H & F & "\DefaultIcon]" & vb & Icon & vb2 &_ H & F & "\shell]" & vb2 &_ H & F & "\shell\open]" & vb2 &_ H & F & "\shell\open\command]" & vb &_ "@=""\""" & AP & "\"" \""%1\""""" RF = RP & IExt & "_Prog" & ".reg" CreateRegFile RF,Reg RunRegFile RF End Sub
Sub CreateRegTextIcon(IExt) F = IExt & "file" : H = "[HKEY_CLASSES_ROOT\" Reg = "Windows Registry Editor Version 5.00" & vb2 &_ H & "." & IExt & "]" & vb & "@=""" & F & """" & vb2 &_ H & F & "]" & vb2 &_ H & F & "\DefaultIcon]" & vb & "@=""" & Replace(ICL, "\", "\\") & "," & GetIcon(IExt) & """" RF = RP & IExt & "_Icon" & ".reg" CreateRegFile RF,Reg RunRegFile RF End Sub
Function GetIcon(IcExt) Select Case IcExt Case "txt" L = 0 ' Case "bar" L = 1 Case "hhp" L = 1 Case "tch","manifest" L = 2 Case "ini","tci","tll" L = 4 Case "lng","lang" L = 5 Case "mnu" L = 6 Case "inc" L = 7 Case "sys" L = 8 Case "rus","ru","russian","pyc" L = 9 Case "1st","me" L = 10 Case "log","gjlog" L = 11 Case "list","lst","lsl" L = 12 Case "reg" L = 13 Case "cmd" L = 14 Case "m3u","m3u8","pls","wpl" L = 15 Case "coder" L = 17 Case "vbs" L = 18 Case "js" L = 19 Case "hta","wsf","wsc" L = 20 Case "pl","pm","py","java","pas","nsm","lua","h" L = 21 Case "input","browse","footer","main","mosaic","playlist","sout","vlm" L = 3 Case "akelmenu","toolbar","param" L = 22 Case "autocomplete" L = 23 Case "ahk" L = 24 Case "tab","bar","tcinfo" L = 25 Case "conf","config","cnfp","cnf" L = 26 Case "au3","a3x" L = 27 Case "tcg" L = 28 Case "tcm" L = 29 Case "bat" L = 30 Case "uue","xxe", "uue" L = 31 Case "pec2bac","bak" ,"old","org","pk","swp","tmp","temp","wbk","ex~","dl~","oc~","co~","ac~","ax~","cn~","cp~","da~","dr~","ie~","sc~","bck","$$$","tmp","back","bkp" L = 32 Case "crypt","AES-crypt" L = 33 Case "hhk" L = 34 Case "hhc" L = 35 Case "mht","htm","html","url","gdb" L = 36 Case Else L = 2 End Select GetIcon = L End Function
Sub RunRegFile(rFile) CreateObject("WScript.Shell").Run Chr(34) & TCIMG & Chr(34) & " regim=" & Replace(rFile, " ", "~~"), 2, True End Sub
Sub RunTCIMG(Param,WaitOnReturn) CreateObject("WScript.Shell").Run Chr(34) & TCIMG & Chr(34) & " " & Replace(Param, " ", "~~"), 1, WaitOnReturn End Sub
Sub CreateRegFile(rFile, rText) AkelPad.WriteFile rFile, rText, -1, 1251, True End Sub
|
|
| |