Jump to content











Photo

Creating an application script


  • Please log in to reply
4 replies to this topic

#1 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10547 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 21 July 2007 - 12:36 AM

Hi everyone!

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


Our tutorial is divided on the following sections
  • Introduction
  • Creating a basic script with wb
  • Finding missing dependencies
  • Adding an Icon
  • Testing
  • 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:
  • write the description of your program
  • select the folder where your script will be placed
  • 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:

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 File  exescan.PNG   16.83KB   214 downloads



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.

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.18KB   391 downloads


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:
  • Some DLL's are not from the system32 folder
  • A few DLL's are called with a name, but the real filename is different
  • 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:

[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:

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.
  • We start by opening up explorer an going to the folder where it is placed the program.
  • Change view mode to icon
  • Press the PrtScr key - this will take a full screenshot of your desktop
  • Open up paint and press Ctrl+V to paste the captured image inside Paint
  • Select only the portion where the icon is placed (32x32 pixels is recomended) and press CTRL+C to copy this specific small selection
  • Start a new image on Paint - no need to save the older one
  • Inside Paint click on Image --> Attributes and change the image size to 1x1 pixel
  • Press Ctrl+V to paste your previously saved image - since the paint image is small - it will resize to match your selection
  • 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?
  • Select the script from wb and enter in edit mode - open up the Description tab and add the new icon you've just created
  • 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!!! :yahoo:

#2 TheHive

TheHive

    Platinum Member

  • .script developer
  • 4168 posts

Posted 21 July 2007 - 05:02 AM

Good tutorial and with video. Good combo to explaining things better.

#3 lonely

lonely
  • Members
  • 6 posts
  •  
    United States

Posted 15 August 2007 - 11:07 AM

thank you

#4 Mr Been

Mr Been
  • Members
  • 0 posts
  • Location:Netherlands
  •  
    Netherlands

Posted 14 September 2007 - 07:44 AM

thank you




Thank you

#5 artal73

artal73
  • Members
  • 6 posts
  •  
    Turkey

Posted 20 October 2007 - 09:03 PM

Thanks to this great topic.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users