If interested, all the plugin build code.
Code: Select all
.........................................................................................
......................Извлекаем необходимые файлы для плагина............................
.........................................................................................
.................................Проверяем существование программы ResourceHacker.exe...............................
GoSub "ResourceHacker"
..............................Создаем файлы tnbp;tnbr...................................
SetVar "[Ext]" "tnbp;tnbr"
StrParse "[Ext]" ";" "[Ext]" "[Ext.Num]"
Loop "1" "[Ext.Num]" "[i]"
FileExists "[PathFolderProject]\[NamePlugin].[Ext[i]]" "[Result]"
If "[Result]" "=" "True"
FileErase "[PathFolderProject]\[NamePlugin].[Ext[i]]"
EndIf
ExtractFile "[Embedded]Example.[Ext[i]]" "[PathFolderProject]\[NamePlugin].[Ext[i]]"
FileExists "[PathFolderProject]\[NamePlugin].[Ext[i]]" "[Result]"
If "[Result]" "=" "False"
DeleteArray "[Ext]" "All"
ClearVariables "Ext,Ext.Num,i,Result"
Return
EndIf
EndLoop
DeleteArray "[Ext]" "All"
ClearVariables "[Ext],[Ext.Num],[i],[Result]"
.............................................................................................
......................Изменяем необходимые файлы для плагина.................................
.............................................................................................
...................................Файл RES..................................................
.Шаблон RC файла с переменными для изменения содержимого файла RES
.(Название плагина, автор, значок и т.д.)
SetVar "[Shablon_RC_File]" "LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL[#13][#10][#13][#10]MAINICON ICON [#34][ICON][#34][#13][#10][#13][#10][#13][#10]1 VERSIONINFO[#13][#10]FILEVERSION 1,5,0,0[#13][#10]PRODUCTVERSION 1,5,0,0[#13][#10]FILEOS 0x4[#13][#10]FILETYPE 0x2[#13][#10]{[#13][#10]BLOCK [#34]StringFileInfo[#34][#13][#10]{[#13][#10] BLOCK [#34]040904E4[#34][#13][#10] {[#13][#10] VALUE [#34]CompanyName[#34], [#34][CompanyName][#34][#13][#10] VALUE [#34]FileDescription[#34], [#34]Плагин NeoBook[#34][#13][#10] VALUE [#34]FileVersion[#34], [#34]1.5.0.0[#34][#13][#10] VALUE [#34]InternalName[#34], [#34][NamePlugin].nbp[#34][#13][#10] VALUE [#34]LegalCopyright[#34], [#34][CompanyName][#34][#13][#10] VALUE [#34]LegalTrademarks[#34], [#34][CompanyName][#34][#13][#10] VALUE [#34]OriginalFilename[#34], [#34][NamePlugin].nbp[#34][#13][#10] VALUE [#34]ProductName[#34], [#34][NamePlugin][#34][#13][#10] VALUE [#34]ProductVersion[#34], [#34][ProductVersion][#34][#13][#10] VALUE [#34]Comments[#34], [#34]Плагин для программы NeoBook[#34][#13][#10] }[#13][#10]}[#13][#10][#13][#10]BLOCK [#34]VarFileInfo[#34][#13][#10]{[#13][#10] VALUE [#34]Translation[#34], 0x0409 0x04E4 [#13][#10]}[#13][#10]}"
.Заполняем все переменные в шаблоне
PopulateStr "[Shablon_RC_File]" "[RC_File]"
.ResourceHacker не понимает кодировку Ansi
zmConvertString "AnsiToUtf8" "[RC_File]" "[RC_File]"
.Сохраняем файл rc
FileWrite "[PathFolderProject]\[NamePlugin].rc" "All" "[RC_File]"
.Вносим с помощью Resource Hacker данные в файл [NamePlugin].res
Run "[ResHacker]" "-open [#34][PathFolderProject]\[NamePlugin].rc[#34] -save [#34][PathFolderProject]\[NamePlugin].res[#34] -action compile -log NUL" "Wait+LoadComplete+Minimized+Hidden" "" ""
ClearVariables "[Shablon_RC_File],[RC_File]"
...................................Файл INI..................................................
.Заполняем переменную PlugInCommandlist (список разделов и команд для отображения в окне О плагине)
StrParse "[ListBoxSections]" "|" "[ListBoxSections]" "[ListBoxSectionsCount]"
Loop "1" "[ListBoxSectionsCount]" "[i]"
If "[PlugInCommandlist]" "=" ""
SetVar "[PlugInCommandlist]" "[ListBoxSections[i]]"
Else
SetVar "[PlugInCommandlist]" "[PlugInCommandlist]|[ListBoxSections[i]]"
EndIf
hpwReplaceRegExp "^|\|" "[Sections[i]]" "|#" "" "[Result]"
SetVar "[PlugInCommandlist]" "[PlugInCommandlist][Result]"
EndLoop
DeleteArray "[ListBoxSections]" "All"
ClearVariables "[ListBoxSectionsCount],[i],[Result]"
.Заполняем переменную ParameterHints (список команд и их описание)
StrParse "[Actions]" "|" "[Actions]" "[ActionsCount]"
Loop "1" "[ActionsCount]" "[i]"
FileRead "[PathFolderFunctions]\[Actions[i]]" "All" "[Function]"
.Поиск параметров функции в файле
hpwExecRegExpList "Param=(.*?\r)" "[Function]" "" "[Result]"
hpwReplaceRegExp "Param=(.*?\r)" "[Result]" "${1}" "1" "[Param]"
StrParse "[Param]" "[#13]" "[Param]" "[TotalParam]"
If "[TotalParam]" ">" "0"
Loop "1" "[TotalParam]" "[n]"
StrParse "[Param[n]]" "|" "[Result]" ""
SetVar "[Result1]" "[Actions[i]]_[n]"
If "[ParameterHints]" "=" ""
SetVar "[ParameterHints]" "[Result1]=[Result3]"
Else
SetVar "[ParameterHints]" "[ParameterHints][#13][#10][Result1]=[Result3]"
EndIf
EndLoop
EndIf
DeleteArray "[Result]" "All"
DeleteArray "[Param]" "All"
ClearVariables "[Result],[Param],[TotalParam],[n],[Function]"
EndLoop
SetVar "[INI]" "[#91]PlugInHeader[#93][#13][#10]PlugInHint=[Comments][#13][#10]PlugInVersion=[ProductVersion][#13][#10]PlugInPublisher=[CompanyName][#13][#10]PlugInWebSite=[LegalTrademarks][#13][#10]PlugInCommandlist=[PlugInCommandlist][#13][#10][#13][#10][#91]ParameterHints[#93][#13][#10][ParameterHints]"
FileWrite "[PathFolderProject]\[NamePlugin].ini" "All" "![INI]"
DeleteArray "[Actions]" "All"
ClearVariables "[PlugInCommandlist],[ParameterHints],[INI],[ActionsCount],[i]"
...................................Файл CFP..................................................
SetVar "[ID]" "1"
StrParse "[ListBoxSections]" "|" "[ListBoxSections]" "[ListBoxSectionsCount]"
Loop "1" "[ListBoxSectionsCount]" "[i]"
.Записываем название разела
If "[PlugInCommandlist]" "=" ""
SetVar "[PlugInCommandlist]" "0|[ListBoxSections[i]]||0|0"
Else
SetVar "[PlugInCommandlist]" "[PlugInCommandlist][#13][#10]0|[ListBoxSections[i]]||0|0"
EndIf
.Получаем имена команд
StrParse "[Sections[i]]" "|" "[Actions]" "[ActionsCount]"
Loop "1" "[ActionsCount]" "[n]"
FileRead "[PathFolderFunctions]\[Actions[n]]" "All" "[Function]"
.Получаем из файла функции комментарий
hpwExecRegExpList "Comment=(.*?\r)" "[Function]" "" "[Result]"
hpwReplaceRegExp "Comment=(.*?\r)" "[Result]" "${1}" "1" "[Comment]"
StrReplace "[Comment]" "|" "[#91]CRLF[#93]" "[Comment]" ""
StrReplace "[Comment]" "[#13]" "" "[Comment]" ""
StrReplace "[Comment]" "[#10]" "" "[Comment]" ""
.Получаем из файла функции параметры и их колличество
hpwExecRegExpList "Param=.*?\|(.*?)\|.*?\r" "[Function]" "[#13][#10]" "[Result]"
hpwReplaceRegExp "Param=.*?\|(.*?)\|.*?\r" "[Result]" "${1}" "1" "[Param]"
If "[Param]" "<>" ""
hpwLineCount "[Param]" "[ParamCount]"
Loop "1" "[ParamCount]" "[m]"
hpwLine "[Param]" "[m]" "[Result]"
ListBoxFindItem "TypeParameter" "[Result]" "[Result]"
hpwLineReplace "[Param]" "[Result]" "[m]" "[Param]"
EndLoop
Else
SetVar "[ParamCount]" "0"
EndIf
If "[ParamCount]" ">" "0"
StrReplace "[Param]" "[#13][#10]" ";" "[Param]" ""
StrLen "[Param]" "[Result]"
StrDel "[Param]" "[Result]" "1" "[Param]"
EndIf
SetVar "[PlugInCommandlist]" "[PlugInCommandlist][#13][#10][ID]|[Actions[n]]|[Comment]|[Param]|[ParamCount]"
SetVar "[ID]" "[ID]+1"
EndLoop
EndLoop
FileWrite "[PathFolderProject]\[NamePlugin].cfp" "All" "![PlugInCommandlist]"
DeleteArray "[ListBoxSections]" "All"
DeleteArray "[Actions]" "All"
ClearVariables "[ListBoxSectionsCount],[ActionsCount],[Function],[i],[n],[m],[Result],[Comment],[Param],[ParamCount],[ID]"
...................................Файл CFR..................................................
hpwExecRegExpList "(?m)^([#91]^0[#93]\|.*?\|).*?(\|.*?\|\d)" "[PlugInCommandlist]" "[#13][#10]" "[PlugInCommandlist]"
hpwReplaceRegExp "(?m)^([#91]^0[#93]\|.*?\|).*?(\|.*?\|\d)" "[PlugInCommandlist]" "${1}${2}" "1" "[PlugInCommandlist]"
FileWrite "[PathFolderProject]\[NamePlugin].cfr" "All" "![PlugInCommandlist]"
ClearVariables "[PlugInCommandlist]"
.........................Создаем файлы команд для плагина....................................
.Список всех команд NeoBook
SetVar "[ListActionsNeoBook]" "AlertBox|ArticleJumpTo|Balloon|BringAppToFront|BrowserBack|BrowserExecScript|BrowserExport|BrowserFind|BrowserForward|BrowserGetElement|BrowserGoTo|BrowserHome|BrowserLoadFromStr|BrowserPrint|BrowserSearch|BrowserSetElement|BrowserStop|Call|ChangeFileExt|CheckInternetConnection|ClearVariables|ClickMouse|CloseApp|CloseCustomWindow|CloseWindow|ConnectToInternet|CreateFolder|CustomWindow|DateToNum|DebugBreakPoint|DefineVar|Delay|DeleteArray|DisableApp|DisableMenuItem|DisableObject|DisconnectFromInternet|DOSCommand|DownloadFile|DropFile|EnableApp|EnableMenuItem|EnableObject|ExecuteAddon|Exit|ExitLoop|ExitWhile|ExtractFile|ExtractFileDrive|ExtractFileExt|ExtractFileName|ExtractFilePath|FileCopy|FileDelLine|FileErase|FileExists|FileInsLine|FileLen|FileList|FileOpenBox|FileRead|FileSaveBox|FileSize|FileToVar|FileWrite|Find|FindFirst|FindNext|FlashBack|FlashForward|FlashGetVar|FlashGotoFrame|FlashPause|FlashPlay|FlashRewind|FlashSetVar|FlashStop|FocusObject|FolderBox|FolderExists|GetArrayInfo|GetMousePos|GetObjectHandle|GetObjectInfo|GetVolume|GetWindowPos|GIFPlay|GIFStop|GoSub|GotoFirstPage|GotoLastPage|GotoLine|GotoNextPage|GotoPage|GotoPageNum|GotoPrevPage|HelpTopic|HideMasterPage|HideMenuItem|HideObject|If|IfEx|ImageWindow|InputBox|InternetFileExists|InternetFileSize|InternetGet|InternetLink|InternetPost|IsAppRunning|ListBoxAddItem|ListBoxChangeItem|ListBoxDeleteItem|ListBoxFindItem|ListBoxGetItem|ListBoxMoveItem|ListBoxSize|ListBoxSort|LoadIcon|LoadVariables|Loop|Math|MCICommand|MediaPlayerPause|MediaPlayerPlay|MediaPlayerRewind|MediaPlayerStop|Menu|MenuEx|MessageBox|MoveObject|MoveObjectAlongPath|NumToDate|ObjectToBack|ObjectToFront|PauseSlideShow|PictureMagnify|PlayCartoonFile|PlaySoundFile|PlayTone|PlayVideoFile|PopulateStr|PopUpImage|PrintDataFile|PrintImageFile|PrintImageFileWH|PrintPage|PrintSetup|PrintTextFile|Random|RefreshObject|RegistryRead|RegistryWrite|RemoveFolder|Return|ReturnToPage|Run|RunInRectangle|RunNeoBook|SaveVariables|SearchStr|SendAppToBack|SendKeys|SendMenuCommand|SendMail|SetMousePos|SetObjectCaption|SetObjectFileName|SetObjectFill|SetObjectFont|SetObjectLine|SetPageBackground|SetPageEffect|SetPrinterOrientation|SetVar|SetVolume|SetWindowPos|ShowErrors|ShowMasterPage|ShowMenuItem|ShowObject|SizeObject|SoundBuzzer|StartSlideShow|StickyNote|StopMedia|StopMovingObject|StopSlideShow|StrDel|StrIns|StrLen|StrLower|StrParse|StrReplace|StrUpper|SubStr|Suspend|SystemInfo|SystemSound|TextWindow|TimerStart|TimerStop|TrackbarSetMax|TrackbarSetMin|While|WhileEx"
StrReplace "[Actions]" "|" "[#13]" "[Actions]" ""
hpwLineCount "[Actions]" "[ActionsCount]"
Loop "1" "[ActionsCount]" "[i]"
hpwLine "[Actions]" "[i]" "[NameAction]"
FileRead "[PathFolderFunctions]\[NameAction]" "All" "[Function]"
.Поиск параметров функции в файле
hpwExecRegExpList "Param=(.*?\r)" "[Function]" "" "[Result]"
hpwReplaceRegExp "Param=(.*?\r)" "[Result]" "${1}" "1" "[Param]"
StrParse "[Param]" "[#13]" "[Param]" "[TotalParam]"
If "[TotalParam]" ">" "0"
Loop "1" "[TotalParam]" "[n]"
StrParse "[Param[n]]" "|" "[Result]" ""
StrReplace "[Function]" "[Result1]" "[#91]$[NameAction]_[n][#93]" "[Function]" ""
DeleteArray "[Result]" "All"
EndLoop
EndIf
hpwReplaceRegExp "{.*End}(.*)" "[Function]" "${1}" "1" "[Function]"
.Проверяем функцию на наличие команд NeoBook
hpwExecRegExpBool "[#91]ListActionsNeoBook[#93]" "[Function]" "[Result]"
If "[Result]" "=" "0"
MessageBox "Внимание" "Функция [NameAction] не содержит команды NeoBook. Все равно хотите продолжить?." "Да|Нет" "[Result]"
If "[Result]" "=" "2"
Return
EndIf
EndIf
SetVar "[Function]" ".hpwPlayMacroSource[Function]"
.Зашифровать исходный код
If "[Encode]" "<>" ""
. hpwEncodeMacroStr "[Function]" "[Password]" "[Function]"
hpwEncodeMacroFile "[Function]" "[Password]" "[PathFolderProject]\[NameAction].txt"
Else
FileWrite "[PathFolderProject]\[NameAction].txt" "All" "[Function]"
EndIf
EndLoop
ClearVariables "[ListActionsNeoBook]"
...................................Вместо Файла BAT..................................................
Run "[ResHacker]" "-addoverwrite [#34][PathFolderProject]\[NamePlugin].tnbr[#34], [#34][PathFolderProject]\[NamePlugin].nbr[#34], [#34][PathFolderProject]\[NamePlugin].res[#34] , , ," "Wait+LoadComplete+Minimized" "" ""
Loop "1" "[ActionsCount]" "[i]"
hpwLine "[Actions]" "[i]" "[NameAction]"
Run "[ResHacker]" "-add [#34][PathFolderProject]\[NamePlugin].nbr[#34], [#34][PathFolderProject]\[NamePlugin].nbr[#34], [#34][PathFolderProject]\[NameAction].txt[#34], PluginCommands,[NameAction],0" "Wait+LoadComplete+Minimized" "" ""
EndLoop
Run "[ResHacker]" "-add [#34][PathFolderProject]\[NamePlugin].nbr[#34], [#34][PathFolderProject]\[NamePlugin].nbr[#34], [#34][PathFolderProject]\[NamePlugin].cfr[#34], PluginConfig,Config,0" "Wait+LoadComplete+Minimized" "" ""
Run "[ResHacker]" "-addoverwrite [#34][PathFolderProject]\[NamePlugin].tnbp[#34], [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].res[#34] , , ," "Wait+LoadComplete+Minimized" "" ""
Loop "1" "[ActionsCount]" "[i]"
hpwLine "[Actions]" "[i]" "[NameAction]"
Run "[ResHacker]" "-add [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NameAction].txt[#34], PluginCommands,[NameAction],0" "Wait+LoadComplete+Minimized" "" ""
EndLoop
Run "[ResHacker]" "-add [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].cfp[#34], PluginConfig,Config,0" "Wait+LoadComplete+Minimized" "" ""
Run "[ResHacker]" "-add [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].nbp[#34], [#34][PathFolderProject]\[NamePlugin].ini[#34], PluginConfig,Ini,0" "Wait+LoadComplete+Minimized" "" ""
StrReplace "[Actions]" "[#13]" "|" "[Actions]" ""
ClearVariables "ActionsCount,i,NameAction,Function,Result,Param,TotalParam,n"
DeleteArray "[Param]" "All"
If I finish, I'll lay out the whole project at our forum.
To me the main thing to understand where I not so do.