0 Members and 1 Guest are viewing this topic.
Ok here it goes.we will start by looking at what makes the Macro Library "turn on"If you look in script.project you will see the following linesCode: [Select]//-- Macro Library File and Some ML project settings%API%=%ProjectDir%\Build\Macro_Library.scriptthis line tells us what file contains macrosCode: [Select]%APIVAR%=ApiVarthis is the name of the section in ML that contains that actual definitions of commands. aka what to do when you Add_shortcut etc.we will look at this section in the Macro Library later.Code: [Select]%APIDEF%=APIthis is simply the name that will be displayed for the api menu in the magic wandCode: [Select]%API_TYPE%=2this variable is used to tell the Macro Library that we are project type 2 (Vista/Win7) and is used to decide what functions in the Macro Library to run when a command is called. (for project type commands ;))1=Gena - PE1 based projects2=Vista/Win7/Win8 based projects - nt6x projects98=Windows98 based projectsCode: [Select]%APISUBDEF%=Add_Shortcut,Add_DesktopIni,Add_Url,Arch,Call,ScriptInterface,Others,Registry,Require_File,RunFrom,Unpack,Variablethis is the api submenu definitions. each entry is a top level menu in the api menuCode: [Select][Process]AddVariables,%API%,ApiVar,GLOBALthis command loads all commands in the Macro_Library.script [ApiVar] as GLOBAL. we will get into this a bit more later. but know that this needs to happen in order for plugins to use the common api commands.Ok now on to Macro_Library.scriptCode: [Select][Api_Def]%APIVAR%=ApiVar%APIDEF%=MacroLibrary%APISUBDEF%=Add_Shortcut,Add_DesktopIni,Add_Url,Arch,Call,ScriptInterface,Others,Registry,Require_File,RunFrom,Unpack,Variablethis section doesn't do anything. it is simply a reminder that you need to set these variables in script.project in order to use the Macro Libraryediting this section will not do anything!!!!!!!Code: [Select][ApiVar][ApiVar]Add_Shortcut=Run,%API%,AddShortcut%_ML_Shortcut_TYPE%Add_Pin=Run,%Api%,Add_Pin_Process%API_TYPE%Add=Run,%API%,Add_----ETC ETC ETC---------this is the section we defined with the line %APIVAR%=ApiVar back in script.projectand loaded into memory with the command Code: [Select][Process]AddVariables,%API%,ApiVar,GLOBALthis is the part where the commands actually get mapped to their functions.an easy way to think of it is that whenever winbuilder sees the command Add_Pin in any plugin it internally replaces the Add_Pin with Run,%Api%,Add_Pin_Process%API_TYPE% which will execute the [Calculate] section in %API% which we defined earlier in script.project as being %ProjectDir%\Build\Macro_Library.scriptnext we define the menu entries for the magic wandCode: [Select][API][*Add_Pin]Full Syntax="//Add_Pin,Type,Order(0,1,2,..,8,9),(path\)FileName,Title,Work Folder,Parameters,(path\)IconFile#$cIconIndex,StartMode=(1,2,3)#$cHotKey,ToolTipText"Default Value="Add_Pin,StartMenu,,%PE_Programs%\%ProgramFolder%\%ProgramExe%,%ProgramTitle%"-=Sample File="Add_Pin,Taskbar,,#$pSystemRoot#$p\calc.exe"Sample Lnk="Add_Pin,StartMenu,0,"$Desktop\My Computer.lnk""Sample RecentPrograms="Add_Pin,RecentPrograms,,$Start_Menu\Programs\Accessories\Notepad.lnk"-=StartMenu="Add_Pin,StartMenu"TaskBar="Add_Pin,Taskbar"RecentPrograms="Add_Pin,RecentPrograms"[Add_URL]Default Value="Add_URL,Favorites,<filename>,<webaddress>"Full Syntax="Add_URL,[Favorites][Links]<TargetPath>,<filename>,<webaddress>,[UrlDll][None]<url icon address>,[None]<IconIndex>,[None]<HotKey>"-=Sample Favorites="Add_Url,,Google.url,http://www.google.com"Sample Links="Add_Url,Links,Google.url,http://www.google.com"-=Sample Favorites SubF="Add_Url,Favorites\My Folder,Google.url,http://www.google.com"Sample AnyFolder="Add_Url,%target_win%,Google.url,http://www.google.com"Sample Icon Url.dll="Add_Url,,Google.url,http://www.google.com,UrlDLL"Sample Icon Ico="Add_Url,,Google.url,#$psystemroot#$p\system32\blabla.ico"the line [API] doesn't do anything. its just a reminder to developers that the next sections are menu definitions and not actually functionsnow you will se a bunch of sections all with names corresponding to the submenus we defined in %APISUBDEF%this is where we actually define the commands to be displayed in the Macro Library magic wand menuwhen winbuilder builds the api menu it looks at %APISUBDEF% and makes the top level entries based on the contents of this variable. next it looks for sections with the name of the top level entries and fills the top level menus with the lines in each section.the sections are layed out like so:name of command as shown in api menu = command to paste into the code editor when you select the command.-= makes a line/divider.and thats the quick and dirty to the Macro Library. the rest of the code is functions for actually doing the work.answers to specific questionswinbuilder does not scan the sections. it only displays the contents of the section referenced by the corresponding name defined in %APISUBDEF%because it is not listed in any of the sections referenced by %APISUBDEF%APISUBDEF is only used by winbuilder itself for building the API menu entriesroutines/functions are added in the [ApiVar] section