Hello dear guest!
Boot Land is a community driven site established since 2006 and focused on data recovery/backup boot disks, research of Windows 2000/XP/2003/Vista/7 install/deployment/antivirus tools, customizing Windows PE systems and even learning how to recover from disaster situations.
How about joining our boot disk community? So do it. Life's short!
- You
get free access to our newsletter with all the interesting
buzz about boot disks
- We share publicity revenue with everyone who wishes to participate at the forums
- Publicity is never, never, never displayed to members (along with many other cool
things)
http://boot-land.net/register
|
 |
App scripts, Common script templates to work across different projects |
|
|
|
Jul 25 2007, 03:45 PM
|
|

|
|
Joined: 13-July 06
From: Pittsburgh
Posts: 7,846
Thank(s): 341
 Portugal

|
|
Hi everyone! We've already discussed previously the introduction of a new API to be used inside scripts. Over the last months it became more visible that a more universal and project independent way to create scripts that can add programs inside our projects needs to be used. So far we've been creating scripts that were written specifically for nativeEx or LiveXP or BartPECore, but why rewrite a script since most tasks are simply repeated across projects and need to make different scripts that add the same program?  To solve this matter a simple set of functions can be used and made available to all scripts across all currently developed projects and the future ones to come. This way your application scripts will still work even when you use another project. Before, a script would need to adapt to work under a specific project Now, projects can adapt to work with these scripts and we get an very big ammount of possible scripts to use inside any project that adds support for this method. Please note - this doesn't mean that projects need to work exclusively with this API method - just need to add a few variables that are recognized by these scripts. All scripts that were specifically written to work with a specific will still work as well as before.. I am posting the changes that should be made for this method to work with LiveXP, NativeEx and NativePE projects. It should soon be adapted for other projects and the concept remains the same - we use variables instead of fixed names and this way make everything work in a more "universal" way which is valid for most common cases when we want to add a program inside a project. Add on script.project: CODE [variables] %api%=%projectdir%\Basic\Build\api.script Add_Shortcut=Run,%api%,AddShortcut Require_File=run,%api%,expand_file Unpack=Run,%api%,depack %source_win%=%SourceDir%\I386 %target_win%=%targetDir%\I386 %source_sys%=%SourceDir%\I386 %target_sys%=%TargetDir%\I386\System32 %HIVE_HKLM%=%targetDir%\I386\System32\setupreg.hiv %HIVE_HKCU%=%TargetDir%\i386\System32\Config\default %HIVE_HKU%=%targetDir%\I386\System32\Config\software %HIVE_BASE%=HKLM %reg_temp%=wb-hive %reg%\=%reg_temp%\ hive_load=run,%api%,reg_hiveload hive_unload=run,%api%,reg_hiveunload reg_add=RegWrite,"%HIVE_BASE%" associate_file=run,%api%,do_associate
This api.script can be placed anywhere you wish but we've defined %api% with the value "%projectdir%\Basic\Build\api.script" inside script.project so it should be placed by default inside the Basic\Build folder. CODE [main] Title=api Description=This script contains a set of magic functions that you can use inside your script to make some tasks easier like creating shortcuts and extracting files. Selected=none Level=1 Credits=To the whole community of developers, beta testers and active members which make these developments fun and interesting. Date=2007-JUL-25 Version=2 Contact=http://www.boot-land.net/forums/Common-API-for-projects-t2100.html Download_Level=0 Author=Boot Land Community
[expand_file] If,NotExistFile,%target_sys%\#1,CopyOrExpand,"%source_sys%\#1","%target_sys%"
[AddShortcut] echo,"" echo,"API - Creating a new shortcut for %programTitle%.. [%programFolder%\%programExe%]" If,#1,Equal,,Set,"%shortcut_type%","SM" If,#1,Equal,Desktop,Set,"%shortcut_type%","DE" If,#1,Equal,StartMenu,Set,"%shortcut_type%","SM" If,#1,Equal,QuickLaunch,Set,"%shortcut_type%","QL" If,#1,Equal,AutoStart,Set,"%shortcut_type%","AU" If,#2,Equal,,StrFormat,filename,%Scriptdir%,#2 Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%\#2","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%"
[depack] echo,"API - Unpacking files and settings.." Set,%folder_name%,#1 If,%folder_name%,Equal,,Set,%folder_name%,Folder system,refreshvars
IniRead,"%ProjectInfo%","TargetPaths","Program_Files",%WorkDir%
DirMake,"%targetDir%\%workDir%" DirMake,"%targetDir%\%workDir%\%ProgramFolder%" echo,"Extracting %ProgramTitle%.." ExtractAllFiles,"%ScriptFile%","%folder_name%","%targetDir%\%workDir%\%ProgramFolder%"
[reg_hiveload] /echo,"Loading #1 hive.." Set,"%hive_file%","%HIVE_#1%" System,RefreshVars echo,"Loading hive from %hive_file%" RegHiveLoad,%reg_temp%,%hive_file%
[reg_hiveunload] /echo,"Unloading %reg_temp%" RegHiveUnLoad,%reg_temp%
[do_associate] echo,"" echo,"API - Associating #1 filetype.." Set,"%my_file_type_label%","#1file" Set,"%my_file_type%","#1" Set,"%my_file_type_action%","#2" Set,"%my_icon_file%","#3" Set,"%my_icon_file_number%","#4"
system,refreshvars
hive_load,HKU reg_add,0x1,"%reg%\Classes\.%my_file_type%",,"%my_file_type_label%"
If,%my_file_type_action%,Equal,,run,%api%,do_associate_action,open If,%my_file_type_action%,Equal,open,run,%api%,do_associate_with_other_file If,%my_file_type_action%,Equal,edit,run,%api%,do_associate_action,edit If,%my_file_type_action%,Equal,icon,run,%api%,do_associate_icon
hive_unload,HKU
[do_associate_action] If,#1,Equal,open,run,%api%,do_associate_icon If,%my_file_type_action%,Equal,,Set,"%my_file_type_action%","open" Set,"%my_parameters%","#$q%1#$q" If,#2,NotEqual,,Set,"%my_parameters%","#2" reg_add,0x2,"%reg%\Classes\%my_file_type_label%\shell\%my_file_type_action%\command",,"#$q#$pProgramFiles#$p\%programFolder%\%programExe%#$q#$s%my_parameters%"
[do_associate_with_other_file] run,%api%,do_associate_icon Set,%my_parameters%,"#$s#$q%1#$q" If,%my_icon_file_number%,NotEqual,,Set,%my_parameters%,"#$s%my_icon_file_number%" system,refreshvars reg_add,0x2,"%reg%\Classes\%my_file_type_label%\shell\%my_file_type_action%\command",,"%my_icon_file%%my_parameters%"
[do_associate_icon] If,%my_icon_file%,Equal,,Set,"%my_icon_file%","#$q#$pProgramFiles#$p\%programFolder%\%programExe%#$q" system,refreshvars If,%my_icon_file_number%,Equal,,reg_add,0x2,"%reg%\Classes\%my_file_type_label%\DefaultIcon",,"%my_icon_file%" If,%my_icon_file_number%,NotEqual,,reg_add,0x2,"%reg%\Classes\%my_file_type_label%\DefaultIcon",,"%my_icon_file%#$c%my_icon_file_number%"
[demo usage] ; Use these examples to see how these commands can be applied inside your app scripts
Add_Shortcut Add_Shortcut,StartMenu Add_Shortcut,StartMenu,Games Add_Shortcut,QuickLaunch Add_Shortcut,AutoStart Add_Shortcut,Desktop
require_file,myLibrary.dll
unpack unpack,AnotherFolder
hive_load,HKU hive_unload,HKU
reg_add,0x1,"%reg%\Classes\filetype","test","1"
associate_file,html associate_file,html,open,c:\test.exe associate_file,html,open,c:\test.exe,/run=%2 associate_file,html,edit associate_file,html,icon,c:\test.exe associate_file,html,icon,%systemroot%\System32\Shell32.dll,-153
[history] 070513 - api.script was created. 070718 - added function "require" (extract/check if system files are available and expand from source if needed - added syntax guide inside script.project from livexp - added %HKLM% and %HKCU% to write registry keys - added %source_win%, %target_win%, %source_sys%, %target_sys% that allow access work folders under most situations (supports both Install CD files or Installed windows dirs) 070723 - added support for creating start menu items based on the folder where the script is placed 070723 - hive_load and hive_unload commands added to support HKCU,HKU and HKLM 070723 - reg_add command added with support for internal and external hive registry writes 070723 - association command was also added to bring support to file associations 070724 - added support to add association to any other files along with custom parameters and custom icons (like shell32.dll,-153) 070724 - unpack was made simpler also extracting from any folder when specified
The above settings might seem a bit complicated, but they are also meant as reference for those who maintain our script projects - by default - most .script developers and everyone else who wishes to write a script won't ever need to worry about them and only needs to know which functions can be used inside their scripts. Proper documentation to explain all this still needs to be elaborated, but here is a small set of demonstration commands that show the scope of possible actions CODE [demo usage] ; Use these examples to see how these commands can be applied inside your app scripts
Add_Shortcut Add_Shortcut,StartMenu Add_Shortcut,StartMenu,Games Add_Shortcut,QuickLaunch Add_Shortcut,AutoStart Add_Shortcut,Desktop
require_file,myLibrary.dll
unpack unpack,AnotherFolder
hive_load,HKU hive_unload,HKU
reg_add,0x1,"%reg%\Classes\filetype","test","1"
associate_file,html associate_file,html,open,c:\test.exe associate_file,html,open,c:\test.exe,/run=%2 associate_file,html,edit associate_file,html,icon,c:\test.exe associate_file,html,icon,%systemroot%\System32\Shell32.dll,-153 These might seem a bit strange and very few when you first look on them, but rest assured that they truly allow to replace most "older" coding which made your scripts limited to work under a specific project. To see how this works in real life usage, let's look on driveimageXML script as example before and after applying the new method. BeforeCODE [Process] Echo,"Making new directories.." IniRead,"%ProjectInfo%","TargetStrings","sProgram_Files",%WorkDir% DirMake,%targetDir%\%workDir%\dixml // Add shortcuts If,%pCheckBox1%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"DE","#$pSystemDrive#$p\%workDir%\dixml\dixml.exe","DriveImage XML" Run,%BuildModelScript%,Add-Shortcut,"SM\Backup","#$pSystemDrive#$p\%workDir%\dixml\dixml.exe","DriveImage XML" Echo,"Extract files.." ExtractAllFiles,"%ScriptFile%","Folder","%targetDir%\%workDir%\dixml" Expand,"%SourceDir%\I386\APPHELP.DL_","%TargetDir%\i386\system32" Expand,"%SourceDir%\I386\LZ32.DL_","%TargetDir%\i386\system32" Expand,"%SourceDir%\I386\WOW32.DL_","%TargetDir%\i386\system32" Expand,"%SourceDir%\I386\NTVDM.EX_","%TargetDir%\i386\system32" Echo,"Loading registry hive: [%TargetDir%\i386\System32\Config\software]" RegHiveLoad,Tmp_software,%TargetDir%\i386\System32\Config\software Echo,"Writing new values on registry hive.." RegWrite,HKLM,0x1,"Tmp_software\Microsoft\Windows NT\CurrentVersion\Fonts","MS Sans Serif 8,10,12,14,18,24 (VGA res)","SSERIFE.FON" RegWrite,HKLM,0x1,"Tmp_software\Microsoft\Windows NT\CurrentVersion\Fonts","MS Serif 8,10,12,14,18,24 (VGA res)","SERIFE.FON" RegWrite,HKLM,0x1,"Tmp_software\Microsoft\Windows NT\CurrentVersion\Fonts","Small Fonts (VGA res)","SMALLE.FON" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}","","Shell Name Space ListView" RegWrite,HKLM,0x2,"Tmp_software\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}\InProcServer32","","%SystemRoot%\System32\shdocvw.dll" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}\InProcServer32","ThreadingModel","Apartment" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}","","Background Task Scheduler" RegWrite,HKLM,0x2,"Tmp_software\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}\InProcServer32","","%SystemRoot%\System32\browseui.dll" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}\InProcServer32","ThreadingModel","Apartment" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}","","Shell Automation Service" RegWrite,HKLM,0x2,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\InProcServer32","","%SystemRoot%\system32\SHELL32.dll" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\InProcServer32","ThreadingModel","Apartment" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\ProgID","","Shell.Application.1" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\TypeLib","","{50a7e9b0-70ef-11d1-b75a-00a0c90564fe}" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\Version","","1.1" RegWrite,HKLM,0x1,"Tmp_software\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\VersionIndependentProgID","","Shell.Application" RegWrite,HKLM,0x1,"Tmp_software\Classes\Shell.Application","","Shell Automation Service" RegWrite,HKLM,0x1,"Tmp_software\Classes\Shell.Application\CLSID","","{13709620-C279-11CE-A49E-444553540000}" RegWrite,HKLM,0x1,"Tmp_software\Classes\Shell.Application\CurVer","","Shell.Application.1" RegWrite,HKLM,0x1,"Tmp_software\Classes\Shell.Application.1","","Shell Automation Service" RegWrite,HKLM,0x1,"Tmp_software\Classes\Shell.Application.1\CLSID","","{13709620-C279-11CE-A49E-444553540000}" RegHiveUnLoad,Tmp_software
AfterCODE [variables] %ProgramTitle%=DriveImage XML %ProgramEXE%=dixml.exe %ProgramFolder%=DriveImageXML
[process] If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop Add_Shortcut,StartMenu unpack echo,"Expanding DLLs..." require_file,APPHELP.DLL require_file,LZ32.DLL require_file,WOW32.DLL require_file,NTVDM.EXE hive_load,HKU reg_add,0x1,"%reg%\Microsoft\Windows NT\CurrentVersion\Fonts","MS Sans Serif 8,10,12,14,18,24 (VGA res)","SSERIFE.FON" reg_add,0x1,"%reg%\Microsoft\Windows NT\CurrentVersion\Fonts","MS Serif 8,10,12,14,18,24 (VGA res)","SERIFE.FON" reg_add,0x1,"%reg%\Microsoft\Windows NT\CurrentVersion\Fonts","Small Fonts (VGA res)","SMALLE.FON" reg_add,0x1,"%reg%\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}","","Shell Name Space ListView" reg_add,0x2,"%reg%\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}\InProcServer32","","%SystemRoot%\System32\shdocvw.dll" reg_add,0x1,"%reg%\Classes\CLSID\{43A8F463-4222-11d2-B641-006097DF5BD4}\InProcServer32","ThreadingModel","Apartment" reg_add,0x1,"%reg%\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}","","Background Task Scheduler" reg_add,0x2,"%reg%\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}\InProcServer32","","%SystemRoot%\System32\browseui.dll" reg_add,0x1,"%reg%\Classes\CLSID\{603D3800-BD81-11d0-A3A5-00C04FD706EC}\InProcServer32","ThreadingModel","Apartment" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}","","Shell Automation Service" reg_add,0x2,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\InProcServer32","","%SystemRoot%\system32\SHELL32.dll" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\InProcServer32","ThreadingModel","Apartment" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\ProgID","","Shell.Application.1" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\TypeLib","","{50a7e9b0-70ef-11d1-b75a-00a0c90564fe}" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\Version","","1.1" reg_add,0x1,"%reg%\Classes\CLSID\{13709620-C279-11CE-A49E-444553540000}\VersionIndependentProgID","","Shell.Application" reg_add,0x1,"%reg%\Classes\Shell.Application","","Shell Automation Service" reg_add,0x1,"%reg%\Classes\Shell.Application\CLSID","","{13709620-C279-11CE-A49E-444553540000}" reg_add,0x1,"%reg%\Classes\Shell.Application\CurVer","","Shell.Application.1" reg_add,0x1,"%reg%\Classes\Shell.Application.1","","Shell Automation Service" reg_add,0x1,"%reg%\Classes\Shell.Application.1\CLSID","","{13709620-C279-11CE-A49E-444553540000}" hive_unload,HKU
Other app script examples SmartFTPCODE [variables] %ProgramTitle%=SmartFTP %ProgramEXE%=SmartFTP.exe %ProgramFolder%=SmartFTP
[process] Add_Shortcut,StartMenu unpack require_file,APPHELP.DLL require_file,ATL.DLL require_file,CLBCATQ.DLL require_file,COMRES.DLL require_file,CREDUI.DLL require_file,CRYPT32.DLL require_file,CSCDLL.DLL require_file,CSCUI.DLL require_file,HNETCFG.DLL require_file,IMGUTIL.DLL require_file,IPHLPAPI.DLL require_file,MFC42.DLL require_file,MLANG.DLL require_file,MSASN1.DLL require_file,MSHTML.DLL require_file,MSIMTF.DLL require_file,MSLS31.DLL require_file,MSV1_0.DLL require_file,MSWSOCK.DLL require_file,MSXML3.DLL require_file,NETSHELL.DLL require_file,OLEACC.DLL require_file,PNGFILT.DLL require_file,RASADHLP.DLL require_file,RASAPI32.DLL require_file,RASMAN.DLL require_file,RICHED20.DLL require_file,RICHED32.DLL require_file,RSAENH.DLL require_file,RTUTILS.DLL require_file,SHDOCVW.DLL require_file,WSHTCPIP.DLL
Reg ShotCODE [variables] %ProgramTitle%=RegShot %ProgramEXE%=RegShot.exe %ProgramFolder%=RegShot
[process] Add_Shortcut,StartMenu unpack
This is not meant to apply for all programs nor is meant to become a "perfect" method - but will make your life simpler when you want to create a new script - there's even a tutorial explaining how this can quickly be done hereAlso look inside other scripts already coded with this method under the download section here. Things may change as we continue our improvements but at least this way you get a good way to write your scripts for a much wider variety of projects - more documentation to follow soon.. How important is this for overall scripting?Makes things simpler and so much more flexible that we can improve and change our favourite projects and still use all available scripts over the next years to come.
--------------------
The revenue from clicking on publicity at this post is given to Nuno Brito
.
|
1 user(s) said "Thank you!" to Nuno Brito for this fantastic post: ludovici |
|
|
Jul 25 2007, 10:24 PM
|
|
|

|
|
Joined: 18-August 06
Posts: 729
Thank(s): 107
 France

|
|
QUOTE (Nuno Brito @ Jul 25 2007, 03:45 PM)  Nuno i think you must correct this : CODE echo,"API - Creating a new shortcut for %programTitle%.. [%programFolder%\%programExe%]" If,#1,Equal,,Set,"%shortcut_type%","SM" If,#1,Equal,Desktop,Set,"%shortcut_type%","DE" If,#1,Equal,StartMenu,Set,"%shortcut_type%","SM" If,#1,Equal,QuickLaunch,Set,"%shortcut_type%","QL" If,#1,Equal,AutoStart,Set,"%shortcut_type%","AU" If,#2,Equal,,StrFormat,filename,%Scriptdir%,#2 Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%\#2","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%"
by CODE echo,"API - Creating a new shortcut for %programTitle%.. [%programFolder%\%programExe%]" If,#1,Equal,,Set,"%shortcut_type%","SM" If,#1,Equal,Desktop,Set,"%shortcut_type%","DE" If,#1,Equal,StartMenu,Set,"%shortcut_type%","SM" If,#1,Equal,QuickLaunch,Set,"%shortcut_type%","QL" If,#1,Equal,AutoStart,Set,"%shortcut_type%","AU" If,#2,Equal,,StrFormat,filename,%Scriptdir%,#2 If,%shortcut_type%,Equal,"SM",Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%\#2","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%" If,%shortcut_type%,NotEqual,"SM",Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%"
Because we don't have to make a folder on Desktop
--------------------
|
|
|
|
Jul 25 2007, 10:44 PM
|
|

|
|
Joined: 13-July 06
From: Pittsburgh
Posts: 7,846
Thank(s): 341
 Portugal

|
|
Hi Pedrole15! Funny you mention it - but shouldn't we be able to create folders on the desktop if needed?  I've also modified this function today to support creating icons using other executables and parameters, but it's not yet finished (it works as expected, but can be simplified to run faster)CODE [AddShortcut] echo,"" If,#1,Equal,,Set,"%shortcut_type%","SM" If,#1,Equal,Desktop,Set,"%shortcut_type%","DE" If,#1,Equal,StartMenu,Set,"%shortcut_type%","SM" If,#1,Equal,QuickLaunch,Set,"%shortcut_type%","QL" If,#1,Equal,AutoStart,Set,"%shortcut_type%","AU" If,#2,Equal,,StrFormat,filename,%Scriptdir%,#2
Set,"%My_Shortcut_FOLDER%",#$pProgramFiles#$p\%programFolder% Set,"%My_Shortcut_EXE%","%My_Shortcut_FOLDER%\%programExe%"
If,#3,NotEqual,,Set,"%My_Shortcut_EXE%","#3" If,#3,NotEqual,,StrFormat,path,#3,%My_Shortcut_FOLDER%
System,RefreshVars
Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%\#2","%My_Shortcut_EXE%#4","%ProgramTitle%","-SW:%My_Shortcut_FOLDER%"
One can use the new function to add icons to files which are by default placed in other folders or even available from the %path% environment variables. The first parameter on "Add_Shortcut,StartMenu,,MSHEARTS.EXE" is empty because it's reserved to define the startmenu folder, and this way we can leave it as default script folder location following your tip..  btw: Peter also suggested to read the value of the title key inside each script.project - what do you think about this idea? It would also keep compatibility of folder names with the download center even when using localized titles for start menu and such..  CODE [variables] %ProgramTitle%=Hearts %ProgramEXE%=MSHEARTS.EXE %ProgramFolder%=MS_Hearts
[process] Echo,"Create a shortcut.." Add_Shortcut,StartMenu,,MSHEARTS.EXE require_file,mshearts.exe require_file,mshearts.hlp require_file,mshearts.cnt require_file,SHIMENG.DLL require_file,ACGENRAL.DLL require_file,CARDS.DLL require_file,SHIMENG.DLL require_file,HHCTRL.OCX require_file,MFC42U.DLL
--------------------
|
|
|
|
Jul 25 2007, 11:04 PM
|
|
|

|
|
Joined: 18-August 06
Posts: 729
Thank(s): 107
 France

|
|
QUOTE (Nuno Brito @ Jul 25 2007, 10:44 PM)  I'am trying some tweak CODE [AddShortcut] echo,"" echo,"API - Creating a new shortcut for %programTitle%.. [%programFolder%\%programExe%]" If,#1,Equal,,Set,"%shortcut_type%","DE" If,#1,Equal,Desktop,Set,"%shortcut_type%","DE" If,#1,Equal,StartMenu,Set,"%shortcut_type%","SM" If,#1,Equal,QuickLaunch,Set,"%shortcut_type%","QL" If,#1,Equal,AutoStart,Set,"%shortcut_type%","AU" If,#2,Equal,,StrFormat,filename,%Scriptdir%,#2 If,#3,Equal,,Set,"%shortCut_Parameters%","" If,#3,NotEqual,,Set,"%shortCut_Parameters%","#$q#$s#$q-SP:%Parameters%" If,#4,Equal,,Set,"%shortCut_IconFile%","" If,#4,NotEqual,,Set,"%shortCut_IconFile%","#$q#$s#$q-SF:#$pProgramFiles#$p\%programFolder%\%IconFile%#$q#$s#$q-SI:0" If,#5,Equal,,Set,"%shortCut_Show%","" If,#5,Equal,"Max",Set,"%shortCut_Show%","#$q#$s#$q-SS:SW_SHOWMAXIMIZED" If,#5,Equal,"Min",Set,"%shortCut_Show%","#$q#$s#$q-SS:SW_SHOWMINIMIZED" If,#5,Equal,"Normal",Set,"%shortCut_Show%","#$q#$s#$q-SS:SW_SHOWNORMAL"
If,%shortcut_type%,Equal,"SM",Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%\#2","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%%shortCut_IconFile%%shortCut_Parameters%%shortCut_Show%" If,%shortcut_type%,NotEqual,"SM",Run,%BuildModelScript%,Add-Shortcut,"%shortcut_type%","#$pProgramFiles#$p\%programFolder%\%programExe%","%ProgramTitle%","-SW:#$pProgramFiles#$p\%programFolder%%shortCut_IconFile%%shortCut_Parameters%%shortCut_Show%"
and in the script CODE [variables] %ProgramTitle%=IrfanView %ProgramEXE%=i_view32.exe %ProgramFolder%=IrfanView %IconFile%=Pmagic.ico %Parameters%=i_view32.bmp
[process] Add_Shortcut,Desktop,,%Parameters%,%IconFile%,Max Add_Shortcut,StartMenu unpack
associate_file,ico associate_file,bmp
It 's working well and can be use with VistaPE with same syntax
--------------------
|
|
|
|
Jul 26 2007, 07:50 AM
|
|

|
|
Joined: 14-July 06
From: Korschenbroich
Posts: 8,903
Thank(s): 557
 Germany

|
|
QUOTE (Nuno Brito @ Jul 26 2007, 01:43 AM)  hmm.. good approach, are you available to start porting these api functions to vistape? Let's see if we can make really simple and solid scripting so that others can learn quickly and lose the fear of applying them to their own application scripts.. Your opinion and help implementing vistape support is really welcome - the more people involved the better we can output some really efficient work for the future script developers and all available projects.  One suggestion to make it 100% complete: To IconFile, add IconIndex. If the .EXE has several icons this makes it possible to chose icon #2 or #3 ... Peter
--------------------
Build the house starting with the basement rather than with the roof! But always have in mind how the roof should be made! There are very rarely problems, in most cases there are issues.
There are never stupid questions, there can be only stupid answers.
|
|
|
|
Jul 26 2007, 09:21 AM
|
|

|
|
Joined: 13-July 06
From: Pittsburgh
Posts: 7,846
Thank(s): 341
 Portugal

|
|
Maybe you could help Peter, I've already added this icon index support while associating with files: CODE associate_file,html,icon,%systemroot%\System32\Shell32.dll,-153 Will look back on the buildmodel documentation and see how it can be implemented..
--------------------
|
|
|
|
Jul 26 2007, 06:11 PM
|
|

|
|
Joined: 14-July 06
From: Korschenbroich
Posts: 8,903
Thank(s): 557
 Germany

|
|
QUOTE (Nuno Brito @ Jul 26 2007, 11:21 AM)  Maybe you could help Peter, I've already added this icon index support while associating with files: Will look back on the buildmodel documentation and see how it can be implemented..  I do not want to prohibit you to look into the doc (it is really explained there  ). Every user should at least have had one look into doc (what do you think, how many did click the help button on buildModel?) But you are very busy with other important things. Include '-SI:<icon index> in the fourth parameter Peter
--------------------
Build the house starting with the basement rather than with the roof! But always have in mind how the roof should be made! There are very rarely problems, in most cases there are issues.
There are never stupid questions, there can be only stupid answers.
|
|
|
|
Jul 26 2007, 06:17 PM
|
|

|
|
Joined: 14-July 06
From: Korschenbroich
Posts: 8,903
Thank(s): 557
 Germany

|
|
Maybe it is too late for this suggestion. In my opinion, to make a script more readable, the API functions should have a special 'design' which makes them visually different from 'normal' WB commands. Just as a sample: $Add_Shortcut$ instead of Add_Shortcut (This is really a sample, not a suggestion of a solution. I personally do not like this 'symbol of capitalism and imperalism'  ) Peter
--------------------
Build the house starting with the basement rather than with the roof! But always have in mind how the roof should be made! There are very rarely problems, in most cases there are issues.
There are never stupid questions, there can be only stupid answers.
|
|
|
|
|
 |
2 User(s) are reading this topic ()
|
|