Digg this topic Add to my del.icio.us Submit to SlashDot  
Reply to this topicStart new topic
> Creating an application script, Quick and detailed with youtube examples.
Nuno Brito
post Jul 21 2007, 12:36 AM
Post #1


Advanced Member
***

Group: .script developer
Posts: 4,203
Joined: 13-July 06
From: Azores
Member No.: 1


Portugal


Hi everyone!

This topic intends to show you how to create a script.


Our tutorial is divided on the following sections
  1. Introduction
  2. Creating a basic script with wb
  3. Finding missing dependencies
  4. Adding an Icon
  5. Testing
  6. Publishing
Introduction

Application script is a simple script that will use a template to add your program inside a project.

The biggest advantage is that you'll be writing a script that can later be used inside liveXP, VistaPE or any other project that appears along the way and supports these templates making it reusable over the years without changes.


This was a needed step so that we could have a common way to make scripts work in the future as things evolve.

More detailed documentation can be read here.

Please note that these instructions are not intended to be perfect and you should be aware that there are several other ways to get the job done - hopefully this tutorial should give you an overall idea and then let you move on to more advanced methods with more confidence.

Look on the forums for automated script create tools such as MakeScript by Pedrole15 and H7PluginBuilder by H7se

--------------------------------------------------------------------------------------------------






Creating a basic script with wb


Since wb 072 there is an included tool that will let you write new scripts using a very simple template.

With this template you can:
  1. write the description of your program
  2. select the folder where your script will be placed
  3. add all files that are part of the program
How to start?
  • Start WinBuilder.exe
  • Click on the Tools button (middle button on the upper right corner of the window)
  • Select the first tab - called "Create"
Inside the initial window you find the source code of your script.

The first three lines are instructions to help fill in the needed details - by default you can change all text strings that start with "my".

Here's an example of this initial template:

QUOTE
How to create a script?

- Edit values that contain a "my"
- Add your files
- Choose location where to place script and click "Create"

[main]
Title=My Program
Description=my Program will be added on the project
Selected=True
Level=5
Version=1

[variables]
%ProgramTitle%=myProgram
%ProgramEXE%=myProgram.exe
%ProgramFolder%=myProgramFolder

[process]
Add_Shortcut,Desktop
Add_Shortcut,StartMenu,myGroup
unpack


How to edit?

Lines in red - should be removed, they're only used as quick help
Text in Green - Edit this to match your program
Line in orange - Will add a shortcut on the desktop - optional setting

Explaining each setting to edit:

Title is how your script title will be displayed inside the main window on wb
Description is (as the name indicates) a short description of your program
%ProgramTitle% is the title of your shortcut
%ProgramEXE% is the name of the file to execute when double clicking on the shortcut (e.g. recuva.exe)
%ProgramFolder% is the simple name of the folder where files will be placed (e.g Recuva)
Add_Shortcut,StartMenu - will add an entry on the start menu - "myGroup" is the folder name inside startmenu
unpack - will simply extract the files you've added inside the script


Select the folder where your script will be placed

On the right of the window there's a tree structure with all folders inside each project.

For liveXP for example - select the LiveXP folder, then click on Apps and select a subfolder where you want your script to be placed - that's it..


Add all files that are part of the program

Select the "Add files" tab and add all files that belong to your program folder - please not that subfolders are not (yet) supported.



Last step

Click on "Create" and a new script will be created.

To view this script on the main window, close the tools tab and press the "Refresh" button on the top-right corner of the window.

You can now browse thought the script structure until you find your script listed where you placed it.






----------------------------------------------------------------------------------------





Finding missing dependencies

Most times - the program itself won't run as it is because most projects use very minimal files to start and not every DLL is available as it can be found on a normal installed windows folder

However we can add the missing DLL files ourselves to the System32 folder (or equivalent) using the "require" function.

This function simply checks if a DLL file is present on this System folder and will copy it from a source if it wasn't found.


------------------------------------------------------

But first, a small introduction to find missing DLL's from a specific program - we'll be using EXE scanner which is a small executable (whose homepage is not available for some time) that will open up a program and list all dll's (dependencies) that it uses while running.

Attached Image




It will automatically remove files that are already listed in a exclusions text file - this is very handy for running your application on a fully installed system and then try to port it over to a PE environment.

On my case I've created a clean LiveXP without extra addons such as other programs and typed the result of a dir *.DLL /b inside the I386 folder.

CODE
dir *.DLL /b > exclusions.txt


This was good enough to get a similar compare list of which files are not copied by default to liveXP

Attached File  ExeScan_modified_for_livexp.zip ( 145.18k ) Number of downloads: 65



Next - I start EXEscan.exe and select the app to run.

Important - do most usual actions expected from the program while running so that all used DLL's can be reported.


When you close the launched program - all used dll's will be listed.


Some details to note:
  1. Some DLL's are not from the system32 folder
  2. A few DLL's are called with a name, but the real filename is different
  3. Not all DLL's are available from the source windows and might show up as errors when running the script


-------------------------------------------------------

Adding these missing DLL's to your script

- Open your script in edit mode (click on edit and select the source code tab inside wb) or open the script with notepad

- Locate the [process] section

- Add a "require_file" line to add up each DLL you want to be "required" as present on the System folder.

Example:

CODE
[process]
require_file,APPHELP.DLL
require_file,ATL.DLL
require_file,CLBCATQ.DLL
require_file,COMRES.DLL


Also a good thing to check if the required dll is also found inside your windows source - for XP this is the I386 folder and the dll files come compressed - you find these files with last letter in file extension as _ - as example:
QUOTE
APPHELP.DLL --> APPHELP.DL_


Require_file will distinguish this difference and will either decompress or copy the required file to the target system folder.


- Save changes and close edit mode - or close notepad

-----------------------------------------------



Adding an Icon

We're just about finished with this script - but we still want to give it a more customized look & feel, so we'll be adding an icon to make it look more "prettier"

How do we create an icon?

- First we need to get a small image. I recommend using the same icon as the exe of the program included inside the script.
  1. We start by opening up explorer an going to the folder where it is placed the program.
  2. Change view mode to icon
  3. Press the PrtScr key - this will take a full screenshot of your desktop
  4. Open up paint and press Ctrl+V to paste the captured image inside Paint
  5. Select only the portion where the icon is placed (32x32 pixels is recomended) and press CTRL+C to copy this specific small selection
  6. Start a new image on Paint - no need to save the older one
  7. Inside Paint click on Image --> Attributes and change the image size to 1x1 pixel
  8. Press Ctrl+V to paste your previously saved image - since the paint image is small - it will resize to match your selection
  9. You can now save your icon anywhere you wish - use BMP at 24bit - it works good enough (jpg and gif also work)
How we add it inside the script?
  1. Select the script from wb and enter in edit mode - open up the Description tab and add the new icon you've just created
  2. Close edit mode
You can also take some time and more details inside this description tab like the homepage where people can view more relevant informations, the name of the author, the date when it was created, etc..







Testing


Very simple - Build your project from scratch and check the log for errors, inside the emulator check if your app works as expected and is placed on the right place..




Publishing

Most of the fun is also about publishing and making these scripts available for others - nothing better than sharing and adding more scripts to our own projects from other authors.

You can share your script using the download section here.

When adding your script, please add relevant informations about the program ( a short description preferably quoted from the author's website), a few screenshots and whenever possible a link to the homepage.



That's it - was a bit lengthy but should help to try out for yourselves..

Good luck!!! (IMG:../forums/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+Quote Post
TheHive
post Jul 21 2007, 05:02 AM
Post #2


Advanced Member
***

Group: .script developer
Posts: 1,858
Joined: 14-July 06
Member No.: 5



Goo tutorial and with video. Good combo to explaining things better.
Go to the top of the page
 
+Quote Post
lonely
post Aug 15 2007, 11:07 AM
Post #3


Newbie
*

Group: Members
Posts: 6
Joined: 12-August 07
Member No.: 10,066


United States


thank you
Go to the top of the page
 
+Quote Post
« Next Oldest · Tutorials · Next Newest »
 

Fast ReplyReply to this topicStart new topic

Collapse

> Similar Topics

  Topic Replies Topic Starter Views Last Action
No new Topic has attachmentsScript for Altiris SVS
22 Trax 734 6th October 2007 - 08:23 AM
Last post by: TheHive
No New Posts Topic has attachmentsAnnouncement
Rescue quartet
13 phox 1,447 1st October 2007 - 12:06 PM
Last post by: efernan
No new Topic has attachmentsAny plan for WB to make universal mini 2k/xp/2k3/vista
64 windrv 2,942 26th September 2007 - 01:04 AM
Last post by: windrv
No New Posts Topic has attachmentsAnfnger braucht Hilfe fr kleines App-Script
9 st-dv 319 23rd September 2007 - 04:46 PM
Last post by: psc
No new Topic has attachmentsApplication Virtualization..
Use ThinStall to make anything Portable...
17 proton 1,134 16th September 2007 - 11:35 PM
Last post by: romsempire


 


Track this topic · Email this topic · Print this topic · Subscribe to this forum

- Lo-Fi Version Time is now: 16th October 2007 - 07:32 AM

MKPortal ©2003-2006 mkportal.it