Jump to content











Photo

[App Scripts Guide] Creating a new app script


  • Please log in to reply
24 replies to this topic

#1 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10465 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 13 April 2008 - 08:19 PM

App Scripts Guide





Index

Chapter 1 - Introduction
Chapter 2 - How to create a new app script
Chapter 3 - Adding Registry keys




Chapter 2 - Creating a new app script






Introduction



Now it's time to learn how you can create an app script to add your favourite programs to a boot disk project.

There are several details that you need to take into account when creating a new app script - most of these details are not specific to winbuilder because they depend exclusively on the conditions that you need to provide in order to allow the program to run in the target operative system.

On this tutorial we will pick on a simple program that doesn't require anything special to run and use it as example to demonstrate some of the basic functions of app scripts.


This will cover the steps used to create shortcuts, show how to attach files to your script and also explain a bit how the coding part works.


This tutorial is suited for programs that are already portable.


On later tutorials we will teach how you can write your registry keys along with other more advanced techniques that explore the full potential of app scripts.

If something is not clear on this tutorial, please post a message so that we can correct or explain in more detail how everything works.



How can I create my app script?




There are a few different ways to create your scripts, we'll mention them here so that you can use the one you prefer best.
  • Text Editors
  • Internal wb Tools



Text editors:

As any other script - you can use any standard text editor like the windows notepad for example.

Your app scripts are usually placed inside "%BaseDir%\Projects\MyProject\Apps"

Where %BaseDir% is the folder where your "WinBuilder.exe" is placed and "MyProject" is the project that you want to build.

For plain text edit, here are some good and free options.
Notepad ++ http://notepad-plus.sourceforge.net/
SciTE http://www.scintilla.org/SciTE.html

This method is only recommended for users who already know their way around the app scripts codings. If you're just starting up fresh then it is recommended to use the internal wb tools since they contain good features that help you make a new script.


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

Internal tools

Inside WinBuilder you find a tool to create a new app script from scratch, let's explain how it works.


Where to find it?

Open up WinBuilder.exe and click on the "Advanced" button, select "Create script"

Posted Image


This is how the Create script tool looks like:
Posted Image


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


First step - Path

The first step to start is selecting the folder where you want your new app script to be placed.

This window will display all folders inside the projects folder. Open the folder corresponding to the project that you are using and look for the "Apps" folder.

Posted Image

It's not an obrigation to place your new script inside this Apps folder but we use it as a way to keep things organized. You can also place your script inside a subfolder of Apps that better describes the category in which it should be placed.



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


Second step - Filename

Now we will choose the filename for your new script.

The only thing needed to be done here is writing the filename on the appropriate box
Posted Image

You don't need to write the extension .script since it will be added automatically, for example "Test" will create an app script called "Test.script" on your disk.



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


Third step - Attach files

Now let's add files inside your script.

On this case we are using as example a very simple program that only uses a few files and doesn't require any registry entries or special DLL's on the window folder - we will talk about these cases over the next tutorials.

Click on the "Add files" tab: Posted Image

Next, click on the + (plus) button and a dialog box will allow you to select the files that you want to include on this list.
Posted Image

You can also remove files when you click on the - (minus) button.

One limitation: this tool will not allow to include subfolders and will only add files.

Later ahead we will mention how to include subfolders inside your app scripts.





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


Fourth step - Write the code


This the most important step of them all.

Many people usually think that writing an app script is complicated but after reading this tutorial you will surely think otherwise.

This is our code window:
Posted Image

The code window already contains by default the code that you need.

The only thing you need to change on this case are all words that start with "My"

Change these words with the respectives ones that fit your app script.

Let's pick on the example of NotePad++ and show how these words should be changed.

My Program (title) --> Notepad++
my Program description (description) --> Open source text editor
myProgram (Title of the shortcut) --> Notepad++
myProgram.exe (filename of the shortcut executable) --> notepad++.exe
myProgramFolder (folder where the files will be placed) --> NotePad++


This means that our end result should look like this:
Posted Image


Let's now explain what each line of code means so that you can understand how things are done.

[main]

Title=Notepad++

Description=Open source text editor

Selected=True

Level=5

Version=1

The [main] section is where the generic information about this script is stored.

  • Title is the name that will be displayed on the WinBuilder script list - it doesn't need to be the same as the filename.
  • Description is a small explanation to provide more informations.
  • Selected value is a way to specify if whether this script should run or not when you build the project.
  • Level - each project will execute scripts based on the number of their level (1..10), app scripts use 5 as default
  • Version is the current version of this script to help other users to know when a new version is available.


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

Next is the [variables] section, as other code languages - you can use variables inside your code that will then be replaced by the respective value that you declare inside this section.

A small apart regarding how variables work. WinBuilder has four levels of possible variables and all of them can be used inside your code.

  • WinBuilder.exe - the script engine will add variables containing information about your machine
  • WinBuilder.ini [variables] - variables placed here will affect all projects and all scripts
  • script.project [variables] - variables on the project file will be available on all scripts inside the project
  • Test.script [variables] - variables inside the script will be available inside the script

More informations: http://boot-land.net..._variables.html

On the case of app scripts we will define the variables that apply to your program

[variables]

%ProgramTitle%=Notepad++

%ProgramEXE%=notepad++.exe

%ProgramFolder%=Notepad++
  • %ProgramTitle% is the variable that will define how the program should be named (used on shortcut title)
  • %ProgramEXE% will point to the filename that will be launched by the shortcut
  • %ProgramFolder% is the folder name where your program files will be placed


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


We finish with the [process] section - this where the code inside the script will be executed by default, for simple app scripts we only need two lines that don't require any editing because they will use the values mentioned on the [variables] section.

[process]

Add_Shortcut

unpack




Explaining how Add_Shortcut works



Add_Shortcut is a generic command that will create a shortcut. On most projects it will create this shortcut inside the Start Menu and will place it inside a subfolder that has the same name as the folder where the respective script is placed.

You don't need to worry where the shortcut will be placed because each project will create them in the best possible way.

By default you should leave this command without changes to be as generic as possible.

Only if required, here are the possible options for this API command.

The first parameter will define the type of shortcut

Add_Shortcut,Desktop (places a icon on the desktop)
Add_Shortcut,StartMenu (default action, will place the icon the StartMenu)
Add_Shortcut,QuickLaunch (Adds the icon the Quick Launch bar)
Add_Shortcut,SendTo (Will add the icon on the right-click menu "Send To")

This seems that it was coded exclusively to work with the explorer shell but it wasn't. If the user prefers (for example) to use xoblite, then the Add_Shortcut will either use the equivalent shortcut or simply ignore the request if it is not possible to execute.




Full syntax of Add_Shortcut


This is a very complete command and you can simply use it without need for parameters or decide to forge your shortcut to work under very specific conditions where supply the needed settings.


Add_Shortcut,[Type],[Folder],[FullFileName],[Title],[Work Folder],[Parameters],[IconFile( .ico .exe)],[StartMode(1, 2, 3, or 4)]

  • [Type] - can be Desktop, StartMenu, QuickLaunch, SendTo
  • [Folder] - fill this value if you want to force the shortcut to be placed on a specific folder
  • [FullFilename] - this switch is used if you want to create a shortcut different of %program_exe%
  • [Title] - set your own title for this shortcut
  • [Work folder] - decide the value for the work folder
  • [Parameters] - if you want to launch the exe with command line parameters, write them here
  • [Iconfile] - you can specify what the icon to be used on the shortcut
  • [StartMode] - Value to set how the window of the launched program should be. 1=Show; 2=Show_Minimized; 3=Show_Maximized; 4=Hide



One note:

As you may note - commas (,) are used to split the options of the command - if you need to use a comma on the title of a shortcut or something similar then you can use the special character #$c that will be replaced by a comma when the script is running.

Here is the list of all possible special characters:
Parameter		   Replace With	   Read as in english



,						  #$c				Commma

space					  #$s				Space

"						  #$q				Quote

%						  #$p				Percentage

break line				 #$x			   Starts a new line





Explaining how unpack works


unpack is a command that is used to extract the program files from your script onto a program folder on your boot disk project.

If you followed the instructions that were used on our example above then all you need to do at this moment is simply call "unpack" and this command will create a new folder inside the target program files folder and extract all files inside your script onto this newly created folder.

---------

But let's go into more details about this command so that you can also use it for any special situation where you need things to work in a more specific manner.


Script allow to attach files inside them and also to organize this files using a sort of folders, this allows you to choose which files or folders to extract as needed.

The unpack command will use the folder called "Folder" as default place to keep all files that you attached using the "Create script" tool

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

How to unpack from another folder?

Use this syntax:
unpack,AnotherFolder

Where AnotherFolder is the name of the folder to be extracted





How to include a huge number of files or subfolders?

The best solution is packing all files inside a compressed file. The supported formats are .ZIP .RAR and .7z

To use this feature you will need to include the folder name where this compressed file is found.

For example
unpack,folder,myCompressedFile.zip



How to use a SFX with unpack?

This is an option that will allow you to compress all your program files inside a self-extractable exe file.

How does it work?

First it will extract your SFX file to the respective program folder, then it will run the SFX so that all files are extracted.

You can also include switches to make this sfx become silent.

A good example to explain how this works can be found here: http://livexp.boot-l...are_free.script

The code for the above example is:
unpack,folder,asquared_free.exe,"-y"





Last step - Create your script


If everything is ready then it's time to finally create your script.

At this moment all you need to do is press this button:
Posted Image

The script will be created using the settings that you have defined.

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

Close this tab and press the Refresh button to view you script listed on the WinBuilder script list.

Posted Image



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


In conclusion..


I hope this tutorial helps you understand how you can create your first app script.

The Add_Shortcut and Unpack commands are very simple to use and also very complete whenever you need a special function.

More examples of app scripts to help you understand this lesson are available here: http://livexp.boot-l...et/LiveXP/Apps/



The next tutorials will focus more advanced methods but I think that this is all you really need for simple programs.


:thumbsup:

Edited by Nuno Brito, 24 August 2008 - 09:59 PM.

  • TheFog likes this

#2 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 13 April 2008 - 09:31 PM

Let me be the first...
:D :thumbsup: B) :tabletalk: :D :D B) B) :w00t: :cheers: :cheers:

:cheers:

#3 ispy

ispy

    Silver Member

  • Tutorial Writer
  • 592 posts
  • Location:PILGRIM

Posted 13 April 2008 - 09:32 PM

Hi Nuno :thumbsup: ,

Many thanks for the tutorial, keep building, keep building!

Just 1? When you say use this on simple programs can you define suitable candidates, which ones should we to steer clear of to start with?

Regards,

ispy :tabletalk:

Hi Amalux,

Re post #4 Kewl, I will await in antiscipation, good on ya!
Regards,

ispy :D

#4 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 13 April 2008 - 09:40 PM

Hi Nuno :thumbsup: ,

Many thanks for the tutorial, keep building, keep building!

Just 1? When you say use this on simple programs can you define suitable candidates, which ones should we to steer clear of to start with?

Regards,

ispy :tabletalk:

Hi ispy,

I'm just about ready to post a little tut on this myself, along with some examples of scripts I've made using Nuno's awesome tools. Hopefully this will help round out the process for ya :D (and give Nuno a break :D )

#5 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10465 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 13 April 2008 - 10:28 PM

Glad you've liked it.

Simple programs that fit on this tutorial are those that match the following restrictions:

- Have few files
- Don't require registry keys
- Don't require additional files on the system32 folder
- Don't require registration of any DLL/OCX activeX dependency
- Don't require any file associations and such


This may seem like a long list of restrictions but many small sized programs will fit nicely on this category.

Next tutorials will focus how each of the listed restrictions can be solved.

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

Amalux - it's good to hear that you're also working on new tutorials, I'll be looking forward to read them! :thumbsup:

#6 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12688 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 14 April 2008 - 12:40 PM

In the explanation of 'advanced shortcuts', please mention in 'parameters' that comma, quote etc. have to be replaced by special strings. I thing, anywhere in the tutorial there is an explanation of these strings.

(Or have they already been anywhere and I missed?)

Peter

#7 enli

enli

    Newbie

  • Members
  • 21 posts
  •  
    India

Posted 15 April 2008 - 11:03 AM

Great Tutorial...

Only thing i would like to say is that you have to mention somewhere that this tutorial can be best used for just adding programs to Live CD which are already portable. ( As you didnt have any option about the registry )

Ahh yes i got the list i wrote myself while learning how to replace those parameters inn winbuilder..So far i know these .


Parameter		   Replce With	   Read as in english

,						  #$c				Commma

space					  #$s				Space

"						  #$q				Quote

%						  #$p				Percentage
Regards
EnLi

EDIT : Sticky please :thumbsup:

#8 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10465 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 15 April 2008 - 12:28 PM

Peter: Added the warning about commas.

Enli: The next tutorials will teach how to use the registry, will add your suggestions! :thumbsup:

#9 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 25 April 2008 - 08:00 AM

Hi Nuno, thanks again for the tutorial! I have a question on adding additional shortcuts from the same program folder; what am I doing wrong here:
[variables]

%ProgramTitle%=Ghost8 Plus

%ProgramFolder%=Ghost8

%ProgramExe%=ghost32.exe



[Process]

unpack

If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostSrv.exe,"Ghost Server"

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostExp.exe,"Ghost Explorer"

If,%pCheckBox3%,Equal,True,Add_Shortcut,QuickLaunch

produces non-working scuts:
Attached File  ghostscuts.JPG   65.68KB   346 downloads

#10 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 27 April 2008 - 05:59 AM

Hi Nuno, thanks again for the tutorial! I have a question on adding additional shortcuts from the same program folder; what am I doing wrong here:

[variables]

%ProgramTitle%=Ghost8 Plus

%ProgramFolder%=Ghost8

%ProgramExe%=ghost32.exe



[Process]

unpack

If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostSrv.exe,"Ghost Server"

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostExp.exe,"Ghost Explorer"

If,%pCheckBox3%,Equal,True,Add_Shortcut,QuickLaunch

produces non-working scuts:
Attached File  ghostscuts.JPG   65.68KB   346 downloads

OK, I got this working 'old school' calling buildmodel.exe
Run,%BuildModelScript%,Add-Shortcut,"SM\Backup\%pTextBox1%","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe1%","Ghost Plus"

If,%pCheckBox1%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"DE","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe1%","Ghost Plus"

If,%pCheckBox3%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"QL","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe1%","Ghost Plus"

Run,%BuildModelScript%,Add-Shortcut,"SM\Backup\%pTextBox1%","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe2%","Ghost Server"

If,%pCheckBox1%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"DE","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe2%","Ghost Server"

If,%pCheckBox3%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"QL","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe2%","Ghost Server"

Run,%BuildModelScript%,Add-Shortcut,"SM\Backup\%pTextBox1%","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe3%","Ghost Explorer"

If,%pCheckBox1%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"DE","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe3%","Ghost Explorer"

If,%pCheckBox3%,Equal,True,Run,%BuildModelScript%,Add-Shortcut,"QL","#$pSystemDrive#$p\%WorkDir%\%ProgramFolder%\%programexe3%","Ghost Explorer"

Works great but is there a simpler way? I can find no way to do this using the new api :lol:

#11 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 27 April 2008 - 06:50 AM

I have a question on adding additional shortcuts from the same program folder; what am I doing wrong here:

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostSrv.exe,"Ghost Server"

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,GhostExp.exe,"Ghost Explorer"

Hi amalux
You can find the syntax in the api.script
Syntax==> Add_Shortcut,[Type],[Folder],[FullFileName],[Title],[Work Folder],[Parameters],[IconFile( .ico .exe)],[StartMode(1, 2, 3, or 4)]
[FullFileName] = %PE_Programs%\%ProgramFolder%\YourProgram.exe

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,%PE_Programs%\%ProgramFolder%\GhostSrv.exe,"Ghost Server"

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,%PE_Programs%\%ProgramFolder%\GhostExp.exe,"Ghost Explorer"

Have try with MakeScript
Pedro

#12 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 27 April 2008 - 07:41 AM

Have try with MakeScript
Pedro

Wow, so much easier, thanks!! :thumbup:

Re your MakeScript, where can I download the latest stand-alone version of the program? I have 13.2, which was excellent but used the old api scripting. I've tried finding more recent versions without luck. I really don't like the script based version, why have to run it from inside WB :lol: It's such a great program on it's own! Please let me know where I can get the latest release.

Thanks again :thumbup:

#13 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 27 April 2008 - 07:44 AM

Wow, so much easier, thanks!! :thumbup:

Re your MakeScript, where can I download the latest stand-alone version of the program? I have 13.2, which was excellent but used the old api scripting. I've tried finding more recent versions without luck. I really don't like the script based version, why have to run it from inside WB :lol: It's such a great program on it's own! Please let me know where I can get the latest release.

Thanks again :thumbup:

The link in my signature

#14 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 27 April 2008 - 10:54 AM

I really don't like the script based version, why have to run it from inside WB :lol: It's such a great program on it's own! Please let me know where I can get the latest release.

Updated see here
or the link in my signature

#15 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 27 April 2008 - 02:59 PM

Updated see here
or the link in my signature

Thank you for the updated links! :thumbup:

Looks good! I will test (both) and report back ASAP in the appropriate place :lol:

#16 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12688 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 27 April 2008 - 03:14 PM

Looks good! I will test (both) and report back ASAP in the appropriate place :lol:



I suggest (in order to hold the topic readable):

Posts #9 and later are rather offtopic (they are due to some API issues, and not to the tutorial). Jaclaz moves them to 'where it may concern' and deletes this (my) entry.

Peter :thumbup:

#17 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 27 August 2008 - 02:17 PM

Nuno,

where to ask question for script syntax??

i looked http://winbuilder.ne...ipt_syntax.html
and i searched in (as much possible i can) existing .script's
i searched in bootland,
looked around bootland....

There should be a place to ask question, i dont like creating a topic when there is already existing one, can you point me a place to ask?

Also here is my question: (will be moved by me if you point somewhere else)

I want my script to decide about source (compressed or uncompressed) automatically (maybe download too but later), but i get warning in log which i dont want, becouse no warning needed with first and 2nd exit, 3rd exit have its warning message already.

[Process]

If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,ShellExecute,Hide,"%Tools%\7za.exe","x #$q%sourcefilezloc%\%sevenzippedpac%#$q -y -o#$q%target_prog%\%ProgramFolder%#$q"

If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,Run,%ScriptFile%,shortcutcreator

If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,Exit,""

If,ExistFile,%sourcefilezloc%\%ProgramEXE%,FileCopy,"%sourcefilezloc%\*.*","%target_prog%\%ProgramFolder%"

If,ExistFile,%sourcefilezloc%\%ProgramEXE%,Run,%ScriptFile%,shortcutcreator

If,ExistFile,%sourcefilezloc%\%ProgramEXE%,Exit,""

Exit,"Sorry no source files found"

Thanks for any help

#18 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10465 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 27 August 2008 - 03:26 PM

Hi Lancelot.

This topic mostly dedicated to app scripts and for general scripting questions you're surely welcome to open a new topic inside any of the winbuilder subforums: http://www.boot-land...s/?showforum=22

----------

To avoid the exit messages:


[Process]
If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,ShellExecute,Hide,"%Tools%\7za.exe","x #$q%sourcefilezloc%\%sevenzippedpac%#$q -y -o#$q%target_prog%\%ProgramFolder%#$q"
If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,Run,%ScriptFile%,shortcutcreator
If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,Exit,""
If,ExistFile,%sourcefilezloc%\%ProgramEXE%,FileCopy,"%sourcefilezloc%\*.*","%target_prog%\%ProgramFolder%"
If,ExistFile,%sourcefilezloc%\%ProgramEXE%,Run,%ScriptFile%,shortcutcreator
If,ExistFile,%sourcefilezloc%\%ProgramEXE%,Exit,""
Exit,"Sorry no source files found"

[file_exists]

ShellExecute,Hide,"%Tools%\7za.exe","x #$q%sourcefilezloc%\%sevenzippedpac%#$q -y -o#$q%target_prog%\%ProgramFolder%#$q"

Run,%ScriptFile%,shortcutcreator





[file_exe_exists]

FileCopy,"%sourcefilezloc%\*.*","%target_prog%\%ProgramFolder%"

Run,%ScriptFile%,shortcutcreator





[file_not_exists]

WebGetIfNotExist,http://mylocation/%sevenzippedpac%,,%sourcefilezloc%\%sevenzippedpac%

If,NotExistFile,%sourcefilezloc%\%sevenzippedpac%,Exit,"Sorry no source files found"



[Process]

If,NotExistFile,%sourcefilezloc%\%sevenzippedpac%,Run,%ScriptFile%,file_not_exists

If,ExistFile,%sourcefilezloc%\%sevenzippedpac%,Run,%ScriptFile%,file_exists

If,ExistFile%sourcefilezloc%\%ProgramEXE%,Run,%ScriptFile%,file_exe_exists

Hope the above code helps.

:whistling:

#19 muniategui

muniategui
  • Members
  • 5 posts
  •  
    Spain

Posted 05 May 2011 - 06:56 PM

sry i don't understand one thing there 5 folders in the folder of notepad++ and i don't understand as i have to do to add the folders to the command unpack i need add something to the command??? or what i need to do to add the folders to my script thanks

#20 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10465 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 05 May 2011 - 08:53 PM

Hola!

Sorry but that is a problem specific to the script that you are using.

Inside the source code of your script there is usually a link for talking about the script. With some luck you might get the author to help you.

I know this all a bit complicated until you understand how things work. If you wish, we can talk this over skype. My skype address is nunobrito.azores

Take care!

#21 mc_something

mc_something
  • Members
  • 1 posts
  •  
    Switzerland

Posted 29 November 2011 - 11:41 AM

could someone please update to version 082 and relink the images? :)

#22 greatdevourer

greatdevourer

    Newbie

  • Members
  • 27 posts
  • Location:United States
  •  
    United States

Posted 29 November 2011 - 02:20 PM

I have a template that I've develop that really make my script development easy.

Here's what I use, I hope that it helps people.

Script_Template_Download.script


[Main]

Title=WinBuilder_Template_For_Applications

Description=Something useful here!

Author=GreatDevourer

Type=script

Selected=False

Level=5

Version=1

Date=2011-11-09

Locked=false

Download_Level=1

[Variables]

//

//==============================================================================

// destination folder

%ProgramFolder%=WinBuilder_Template_For_Applications

// application EXE file

%ProgramEXE%=WinBuilder_Template_For_Applications.exe

//start menu title

%ProgramTitle%=WinBuilder_Template_For_Applications

// where the local files to include in the build are stored

// this location is usually relative to the script location

%Local_Folder%=WinBuilder_Template_For_Applications

// name of the file downloaded and stored locally

%Local_Archive%=archive.zip

[Interface]

//

//==============================================================================

// the selections below are a minimal ammount of information for the build

pBevel1=pBevel1,1,12,30,57,236,155

pCheckBox1="Add desktop shortcut",1,3,43,72,185,18,False

pCheckBox2="Add start menu shortcut",1,3,43,126,168,18,True

pCheckBox3="Add quicklaunch shortcut",1,3,43,99,180,18,False

TBoxFolder="Folder in menu (empty for scriptfolder)",1,0,45,171,165,21,"HD Tasks"

// enable options for downloading and updating

pCheckBox4="Delete local files and download new version",1,3,44,231,256,18,True

pWebLabel1="Homepage",1,10,30,18,200,18,http://www.google.com

pTextBox1="Download Link",1,0,45,275,333,21,http://www.google.net/something.zip

[Process]

//

//==============================================================================

// core processing of files, registry entries, and everything else

Echo,Processing %ProgramTitle%...

RunFromRam,False

//

//------------------------------------------------------------------------------

// support for multiple projects

//

// Check for Windows XP

Set,%IsPE1%,False

If,ExistFile,%source_win%TXTSETUP.SIF,Set,%IsPE1%,True

//

// Set Windows x86/x64 variables

Set,%registrysub%,""

Set,%systemreglocation%,""

Set,%systemreglocations%,""

//

// Settings for Windows 7 x86 builds

If,%SourceArch%,Equal,x86,Begin

  Set,%systemreglocation%,system32

  Set,%systemreglocations%,system32

End

// Settings for Windows 7 x64 builds

If,%SourceArch%,Equal,x64,Begin

  Set,%registrysub%,Wow6432Node

  Set,%systemreglocation%,SysWOW64

  Set,%systemreglocations%,syswow64 

End

//

//------------------------------------------------------------------------------

// download the file from the vendor website

If,%pCheckBox4%,Equal,True,Run,%ScriptFile%,FlushCache

// download the file from the vendor website if it is not currently available

If,NotExistFile,"%ScriptDir%%Local_Folder%%Local_Archive%",Run,%ScriptFile%,FlushCache

//

//------------------------------------------------------------------------------

// create destination folder

Echo,"Making new directories.."

DirMake,%target_prog%%ProgramFolder%

//

//------------------------------------------------------------------------------

// copy files from source to destination

Echo,"Copying directories.."

// extract files from the downloaded archive

If,ExistFile,"%ScriptDir%%Local_Folder%%Local_Archive%",Begin

  ShellExecute,Hide,"%Tools%7za.exe","x #$q%ScriptDir%%Local_Folder%%Local_Archive%#$q -y -o#$q%target_prog%%ProgramFolder%#$q"

End

// copy files from the folder

If,ExistFile,"%ScriptDir%%Local_Folder%%ProgramEXE%",Begin

  FileCopy,"%ScriptDir%%Local_Folder%*.*",%target_prog%%ProgramFolder%

End

//

//------------------------------------------------------------------------------

Run,%ScriptFile%,RegistrySettings

//

//------------------------------------------------------------------------------

// add Windows Start Menu items, desktop shortcuts

If,%pCheckBox1%,Equal,True,Add_Shortcut,Desktop

If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%TBoxFolder%,"%PE_Programs%%ProgramFolder%%ProgramEXE%","%ProgramTitle%"

If,%pCheckBox3%,Equal,True,Add_Shortcut,QuickLaunch

[FlushCache]

//

//------------------------------------------------------------------------------

// delete the local fiels and download the files from the Internet

// Make local cache folder if it does not exist

If,ExistDir,"%ScriptDir%%Local_Folder%",DirDelete,"%ScriptDir%%Local_Folder%"

If,NotExistDir,"%ScriptDir%%Local_Folder%",DirMake,"%ScriptDir%%Local_Folder%"

Echo,"Delete cached files and download current version from website..."

If,ExistFile,"%ScriptDir%%Local_Folder%%Local_Archive%",FileDelete,"%ScriptDir%%Local_Folder%%Local_Archive%"

WebGetIfNotExist,%pTextBox1%,"%ScriptDir%%Local_Folder%%Local_Archive%",,"Download current file",15

[RegistrySettings]

//

//------------------------------------------------------------------------------

// configure registry settings

Hive_Load,HKLM

Echo,"Writing new values on registry hive.."

Hive_Unload,HKLM


  • Nuno Brito likes this

#23 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1336 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 29 November 2011 - 05:21 PM

could someone please update to version 082 and relink the images? :)

It is one of the many things "on the list" for the doc project to make some better tutorials...

I have a template that I've develop that really make my script development easy.

Here's what I use, I hope that it helps people.

You should consider posting in downloads section...

#24 greatdevourer

greatdevourer

    Newbie

  • Members
  • 27 posts
  • Location:United States
  •  
    United States

Posted 29 November 2011 - 10:22 PM

I will upload the template to the downloads section after I make a few revisions that I discovered today. I'm hoping to have it up tomorrow.

#25 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 126 posts
  •  
    Australia

Posted 07 March 2014 - 11:34 AM

Hello

 

The posted images are not displaying for me (using Firefox), any idea what might cause this?

 

Thanks






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users