Jump to content











Photo
- - - - -

How to auto start a small standalone application in winpeshl.ini


  • Please log in to reply
17 replies to this topic

#1 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 03 May 2012 - 09:11 PM

Hi,

I am new to WinPE but I managed to get Win7PE_SE_20120416 to run just fine. I have been trying for several days to automatically start a small stanalone application in winpeshl.ini by adding the following command to Shell & Config script.

Added to [BootAutomatization] just after TXTAddLine,%TargetDir%\windows\system32\winpeshl.ini,[LaunchApps],Append
TXTAddLine,%TargetDir%\windows\system32\winpeshl.ini,"#$pSystemDrive#$p\Programs\Myapp.exe",Append


BUT I can't get my application to auto start, what did I do wrong?!!

#2 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 777 posts
  •  
    France

Posted 03 May 2012 - 11:37 PM

Welcome,

TXTAddLine,%TargetDir%\windows\system32\winpeshl.ini,"#$pSystemDrive#$p\Programs\Myapp.exe",Append


%SystemDrive% corresponds to X: you probably want to talk about Program Files ;)
TXTAddLine,%TargetDir%\windows\system32\winpeshl.ini,"#$pSystemDrive#$p\Program Files\MyFolder\MyApp.exe",Append

or

TXTAddLine,%target_sys%\winpeshl.ini,"#$pSystemDrive#$p\Program Files\MyFolder\MyApp.exe",Append


You have also AddAutoRun to start a program before the shell, but later in winpeshl.ini, launch by shortcuts program.
AddAutoRun,"MyTitle","#$pSystemDrive#$p\Program Files\MyFolder\MyApp.exe",,1

Example in ClearLock to Lock the computer at startup.

:cheers:

#3 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 04 May 2012 - 01:41 AM

Hi ChrisR,

Many thanks for your quick response.

Correct me if i am wrong but this is what i am trying to do to integrate my application into win7PE.

Step 1: Put my application under directory C:\Win7PE_SE_20120416\Projects\Win7PE_SE\Apps\Portable\Pstart\Myapp.exe
Step 2: Open Win7PESE80_Builder.exe and under Apps -> turn on "Portable".
Step 3: Run WinBuilder to generate ISO and burn onto DVD.
Step 4: Boot up into the WinPE operating system and I can see my application under CD Drive (Y:) Win7PE \Programs\Myapp.exe

I thought %SystemDrive% refers to Y:\ that is why I used the following command

TXTAddLine,%TargetDir%\windows\system32\winpeshl.ini,"#$pSystemDrive#$p\Programs\Myapp.exe",Append

It looks like this is not as straight forward as I thought.

I've looked through the ClearLock.script that you mentioned but I've been feeling a bit overwhelmed. This is my
first time using WinPE so would you kindly provide step-by-step instructions on how to automatically start
a small standalone application.

#4 RoyM

RoyM

    Frequent Member

  • .script developer
  • 345 posts
  • Interests:Component level repair, Micro-processor based equipment. Computer Repair + Custom Builds.
    (ie. Game Machines, Custom Firewalls\Smoothwalls)
    Network Penetration and testing, Including Wireless.
    Fishing, Hunting, Camping, Gaming.
  •  
    United States

Posted 04 May 2012 - 02:41 AM

Hi vant

I suggest that instead of hacking on Shell & Config script
Start a new script named Myapp.script or something.

Myapp.script will handle copying Myapp.exe to build
and adding any other entries you may need.

Below is an example to get you started.
be sure to encode your file Myapp.exe into Myapp.script

[Variables]
%ProgramEXE%=Myapp.exe
%ProgramFolder%=Myapp
%ProgramTitle%=Myapp

[Interface]
pCheckBox1="Run from ram (boot.wim)",1,3,16,50,183,18,False
pCheckBox2="Create Startmenu Shortcut",1,3,18,192,185,18,True
pTextBox1="Start menu folder (blank for none):",1,0,33,125,168,21,"Myapp"
pTextBox2="Name for Shortcuts:",1,0,33,168,168,23,Myapp
pCheckBox3="Create Desktop Shortcut",1,3,18,213,200,18,False
[Process]
Echo,".....Starting %ProgramTitle%",WARN
Echo,"Processing %ProgramTitle%..."
ReadEnv,BuildModel
## Run from ram
If,%pCheckBox1%,Equal,True,Begin
SET,"%DestDir%","%TargetDir%Program#$sFiles"
SET,"%LinkDir%","%SystemDrive%Program#$sFiles%ProgramFolder%"
End
## Run from CD
If,%pCheckBox1%,Equal,False,Begin
SET,"%DestDir%","%TargetDir%Programs"
SET,"%LinkDir%","%PE_Programs%%ProgramFolder%"
End
##
If,NOTEXISTDIR,"%DestDir%%ProgramFolder%",DirMake,"%DestDir%%ProgramFolder%"
Unpack,Folder,Myapp.7z,True,"%DestDir%%ProgramFolder%"
Run,%ScriptFile%,Shortcuts
Echo,".....Ending %ProgramTitle%",WARN
##
[Shortcuts]
If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,%LinkDir%%ProgramEXE%,%ProgramTitle%,%LinkDir%
If,%pCheckBox3%,Equal,True,Add_Shortcut,Desktop,,%LinkDir%%ProgramEXE%,%ProgramTitle%,%LinkDir%
##

#5 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 04 May 2012 - 06:34 AM

Hi RoyM,

I created a simple script as you suggested and put it under C:\Win7PE_SE_20120416\Projects\Win7PE_SE\Apps\Portable\Myapp.script (Step 1)

Step 2: Put my application under directory C:\Win7PE_SE_20120416\Projects\Win7PE_SE\Apps\Portable\Pstart\Myapp\Myapp.exe (same as before)
Step 3: Open Win7PESE80_Builder.exe and under Apps -> turn on "Portable" (same as before)
Step 4: Expand the "Portable" -> and turn on "Test" (the new script that I created)
Step 5: Run WinBuilder to generate ISO and burn onto DVD.
Step 6: Boot up into the WinPE operating system and I can see the Desktop shortcut. When I click on the Desktop Shortcut the application runs just fine.

I then added the AddAutoRun command that suggested by ChrisR using the ClearLock.script as an example BUT my application won't auto start. Why?!!

Here's my script.

[Main]
Title= Test
Description= My application
Date=04.05.2012
Selected=True
Download_Level=1

[Variables]
%ProgramEXE%=Myapp.exe
%ProgramFolder%=Myapp
%ProgramTitle%=Myapp

[Interface]
pCheckBox1="Run from ram (boot.wim)",1,3,16,50,183,18,False
pCheckBox2="Create Startmenu Shortcut",1,3,18,192,185,18,True
pTextBox1="Start menu folder (blank for none):",1,0,33,125,168,21,"Myapp"
pTextBox2="Name for Shortcuts:",1,0,33,168,168,23,Myapp
pCheckBox3="Create Desktop Shortcut",1,3,18,213,200,18,True
CB_Startup="Lock on computer startup",1,3,16,198,217,14,False,_Select_CB_Startup_,True <<<<<<<<<<<<<<<<<<<<<< I added this line

[Process]
Echo,".....Starting %ProgramTitle%",WARN
Echo,"Processing %ProgramTitle%..."
ReadEnv,BuildModel
## Run from ram
If,%pCheckBox1%,Equal,True,Begin
SET,"%DestDir%","%TargetDir%\Program#$sFiles"
SET,"%LinkDir%","%SystemDrive%\Program#$sFiles\%ProgramFolder%"
End
## Run from CD
If,%pCheckBox1%,Equal,False,Begin
SET,"%DestDir%","%TargetDir%\Programs"
SET,"%LinkDir%","%PE_Programs%\%ProgramFolder%"
End
##
If,NOTEXISTDIR,"%DestDir%\%ProgramFolder%",DirMake,"%DestDir%\%ProgramFolder%"
Unpack,Folder,Myapp.7z,True,"%DestDir%\%ProgramFolder%"
Run,%ScriptFile%,Shortcuts
Echo,".....Ending %ProgramTitle%",WARN
##
If,%CB_Startup%,Equal,True,AddAutoRun,"Myapp Autostart",#$pCDDrive#$p\Programs\Myapp.exe,,1 <<<<<<<<<<<<<<<<<<<<<< added this line

[Shortcuts]
If,%pCheckBox2%,Equal,True,Add_Shortcut,StartMenu,%pTextBox1%,%LinkDir%\%ProgramEXE%,%ProgramTitle%,%LinkDir%
If,%pCheckBox3%,Equal,True,Add_Shortcut,Desktop,,%LinkDir%\%ProgramEXE%,%ProgramTitle%,%LinkDir%
##

[EncodedFile-x86-Myapp.exe]
Encode,C:\Win7PE_SE_20120416\Projects\Win7PE_SE\Apps\Portable\Myapp.script,Folder,C:\Win7PE_SE_20120416\Projects\Win7PE_SE\Apps\Portable\Myapp\Myapp.exe
##

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 8,996 posts
  • Location:The Outside of the Asylum
  •  
    Italy

Posted 04 May 2012 - 07:14 AM

Winpeshl.ini is "tricky".
Check if you are not - by any chance - in this situation:
http://www.msfn.org/...ni-not-running/

Post the resulting winpshl.ini for review:

:cheers:
Wonko

#7 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 777 posts
  •  
    France

Posted 04 May 2012 - 11:48 AM

Here is an example skeleton script where AddAutoRun works.


[Variables]

%ProgramEXE%=Myapp.exe

%ProgramFolder%=Myapp

%ProgramTitle%=MyTitle



[Interface]

ScrollBox_RunFromWhere="Run from RAM",1,4,4,9,148,21,"Run default","Run from RAM","Run from CD"

pBevel1=pBevel1,1,12,4,38,148,167

CheckBox_SM="Start menu shortcut",1,3,8,42,122,18,True

CheckBox_DT="Desktop shortcut",1,3,8,61,122,18,False

CheckBox_RP="Recent Programs",1,3,8,80,122,18,True

TextBox_SMN="Start Menu folder:",1,0,10,117,136,21,Myapp

TextBox_SCN="Name for Shortcuts:",1,0,10,154,136,23,MyName

CheckBox_Startup="AddAutorun MyaApp",1,3,10,182,138,18,True



[Process]

Echo,"Processing %ScriptTitle%..."

StrFormat,REPLACE,%ScrollBox_RunFromWhere%," ","",%runfrom%

If,Not,%runfrom%,Equal,Rundefault,Call,VariableToMacro,%runfrom%,True

//-

Run,%ScriptFile%,Extract

//-

Run,%ScriptFile%,Registry

//-

Run,%ScriptFile%,Shortcuts



[Extract]

If,Not,ExistDir,%Target_Prog%%ProgramFolder%,DirMake,%Target_Prog%%ProgramFolder%

ExtractFile,%ScriptFile%,MyFolder,Myapp.exe,%Target_Prog%%ProgramFolder%



[Registry]



[Shortcuts]

If,%CheckBox_SM%,Equal,True,Add_Shortcut,StartMenu,%TextBox_SMN%,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN%

If,%CheckBox_DT%,Equal,True,Add_Shortcut,Desktop,,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN%

If,%CheckBox_RP%,Equal,True,Begin

  If,%CheckBox_DT%,Equal,True,Add_Pin,RecentPrograms,,$Desktop%TextBox_SCN%.lnk

  Else,If,%CheckBox_SM%,Equal,True,Add_Pin,RecentPrograms,,$Start_MenuPrograms%TextBox_SMN%%TextBox_SCN%.lnk

End

If,%CheckBox_Startup%,Equal,True,AddAutoRun,%TextBox_SCN%,%PE_Programs%%ProgramFolder%%ProgramExe%,,1


Here, MyApp script with a small Program MyApp.exe (MsgBox "Hello world" with 5s timeout) for test.

ps: To easily create a script for a portable application, you can use "SC Packed" or "SC Innounp" (Inno Setup Unpacker) in Utils folder.

Happy Testing and good WB learning :cheers:

Attached Files

  • Attached File  Myapp.7z   289.42K   5 downloads


#8 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 05 May 2012 - 12:27 AM

Hi,

I want to say thank you to ChrisR & RoyM and Wonko the Sane for all your help and assistance. I appreciate your efforts to help other like myself. I've managed to auto load my application using ChrisR's skeleton script.

I've one more question. I want my application to read a config file located under CD Drive (Y:) Win7PE \Programs\Myapp\Config.ini when it kick in @ auto start. How can I do this?

#9 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 777 posts
  •  
    France

Posted 05 May 2012 - 10:06 AM

I've one more question. I want my application to read a config file located under CD Drive (Y:) Win7PE \Programs\Myapp\Config.ini when it kick in @ auto start. How can I do this?


So in the same folder as MyApp.exe, well, use directly the path to your program.
eg in Autoit, use @ScriptDir (Directory containing the running script without containing a trailing backslash).

Local $var = IniRead(@ScriptDir & "\MyConfig.ini", "MySection", "MyKey", "NotFound")

MsgBox(4096, "Result", $var)

The same style should be achievable in all languages (%~dp0 in batch).
Up to you :)

#10 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 06 May 2012 - 03:23 AM

I've tried to provide direct link to the configuration file as follow BUT it is not working.

If,%CheckBox_Startup%,Equal,True,AddAutoRun,%TextBox_SCN%,%PE_Programs%\%ProgramFolder%\%ProgramExe%, "-c %PE_Programs%\%ProgramFolder%\Congfig.ini",1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I added the direct path to the config file

Is there any way to set the current working directory to the CD Drive (Y:) Win7PE \Programs\Myapp\*.* since my application and all the configuration files are in the same location \Myapp\*.*

I'm just wondering whether the reason for not be able to locate the configuration files has anything to do with default shell hasn't load up yet OR for some reason the current working directory is not searched.

#11 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 06 May 2012 - 06:08 AM

I've tried to provide direct link to the configuration file as follow BUT it is not working.

If,%CheckBox_Startup%,Equal,True,AddAutoRun,%TextBox_SCN%,%PE_Programs%\%ProgramFolder%\%ProgramExe%, "-c %PE_Programs%\%ProgramFolder%\Congfig.ini",1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I added the direct path to the config file

Is there any way to set the current working directory to the CD Drive (Y:) Win7PE \Programs\Myapp\*.* since my application and all the configuration files are in the same location \Myapp\*.*

I'm just wondering whether the reason for not be able to locate the configuration files has anything to do with default shell hasn't load up yet OR for some reason the current working directory is not searched.



I added this command "-c %PE_Programs%\%ProgramFolder%\Congfig.ini", however, the above text did not align correctly and pointing to the wrong command.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I added the direct path to the config file

#12 RoyM

RoyM

    Frequent Member

  • .script developer
  • 345 posts
  • Interests:Component level repair, Micro-processor based equipment. Computer Repair + Custom Builds.
    (ie. Game Machines, Custom Firewalls\Smoothwalls)
    Network Penetration and testing, Including Wireless.
    Fishing, Hunting, Camping, Gaming.
  •  
    United States

Posted 06 May 2012 - 05:06 PM

Hi vant

Try writing a small batch to change directory and start Myapp.exe
Contents of Myapp.cmd
----------------------------------
cd /D Y:Win7PEProgramsMyapp
set Path=%Path%;Y:Win7PEProgramsMyapp
Y:Win7PEProgramsMyappMyapp.exe

#13 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 07 May 2012 - 08:43 AM

Hi vant

Try writing a small batch to change directory and start Myapp.exe
Contents of Myapp.cmd
----------------------------------
cd /D Y:\Win7PE\Programs\Myapp
set Path=%Path%;Y:\Win7PE\Programs\Myapp
Y:\Win7PE\Programs\Myapp\Myapp.exe


Following your recommendation, I try to write something like this in the script BUT it won't compile.

Shellexecute,Hide,cmd.exe,"cd /D #$q%Target_Prog%\%ProgramFolder%#$q",%Target_Prog%\%ProgramFolder%
Shellexecute,Hide,cmd.exe,"set Path=#$q%Path%#$q;#$q%Target_Prog%\%ProgramFolder%#$q",%Target_Prog%\%ProgramFolder%

#14 RoyM

RoyM

    Frequent Member

  • .script developer
  • 345 posts
  • Interests:Component level repair, Micro-processor based equipment. Computer Repair + Custom Builds.
    (ie. Game Machines, Custom Firewalls\Smoothwalls)
    Network Penetration and testing, Including Wireless.
    Fishing, Hunting, Camping, Gaming.
  •  
    United States

Posted 07 May 2012 - 01:12 PM

Hi vant

In a running PE, navigate to X:
create new text file named Myapp.cmd
paste or write these contents in file and save.


cd /D Y:Win7PEProgramsMyapp
set Path=%Path%;Y:Win7PEProgramsMyapp
Y:Win7PEProgramsMyappMyapp.exe


Open command prompt, type: x:Myapp.cmd
post results of outcome.


#15 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 08 May 2012 - 12:03 PM

Hi RoyM & ChrisR,

Many thanks for your responses. They've been really helpful. I've managed to combine ChrisR's skeleton script + RoyM's batch file and FINALLY got everything working... Yippee!!


Here're my step-by-step instructions to auto start a standalone application in WinPE.

Step 1: Requirements - a) ChrisR's skeleton script
B) RoyM's batch file
c) your application + configure files

Step 2: Where to put these files - ChrisR's skeleton script will go under directory C:Win7PE_SE_20120416ProjectsWin7PE_SEAppsPortable
- RoyM's batch file will need to be encoded into ChrisR's skeleton script
- Put your application + configure files under directory C:Win7PE_SE_20120416ProjectsWin7PE_SEAppsPortablePstartMyappMyapp.exe + configure files

Step 3: Open Win7PESE80_Builder.exe and under Apps -> click on "Portable" -> then click on "Myapp".

Step 4: You need to encode RoyM's batch file into ChrisR's skeleton script by clicking on that tiny "Edit" button (the icon looks like a spanner).
Click on "Attachments" -> click "Add.."-> click "+Add.." to locate where you put RoyM's batch file -> finally clicks "Start" to encode the batch file into the script.

Step 5: Click "Source" -> then click the "green arrow" button to compile it.

Step 6: Go back to the main page and press the "BLUE Play" button to generate ISO and burn onto DVD.

Step 7: Boot up into the WinPE operating system and the auto boot should start your application

I made a few minor changes to ChrisR's skeleton script to load up RoyM's batch file

[Variables] %ProgramEXE%=Myapp.cmd <<<<<<<<<<<<<<<<<<<<<<<<< I made the change here to load up RoyM's batch file %ProgramFolder%=Myapp %ProgramTitle%=MyTitle [Interface] ScrollBox_RunFromWhere="Run from RAM",1,4,4,9,148,21,"Run default","Run from RAM","Run from CD"
pBevel1=pBevel1,1,12,4,38,148,167 CheckBox_SM="Start menu shortcut",1,3,8,42,122,18,True CheckBox_DT="Desktop shortcut",1,3,8,61,122,18,False CheckBox_RP="Recent Programs",1,3,8,80,122,18,True TextBox_SMN="Start Menu folder:",1,0,10,117,136,21,Myapp TextBox_SCN="Name for Shortcuts:",1,0,10,154,136,23,MyName CheckBox_Startup="AddAutorun MyaApp",1,3,10,182,138,18,True [Process] Echo,"Processing %ScriptTitle%..." StrFormat,REPLACE,%ScrollBox_RunFromWhere%," ","",%runfrom% If,Not,%runfrom%,Equal,Rundefault,Call,VariableToMacro,%runfrom%,True //- Run,%ScriptFile%,Extract //- Run,%ScriptFile%,Registry //- Run,%ScriptFile%,Shortcuts [Extract] If,Not,ExistDir,%Target_Prog%%ProgramFolder%,DirMake,%Target_Prog%%ProgramFolder% ExtractFile,%ScriptFile%,MyFolder,Myapp.exe,%Target_Prog%%ProgramFolder% [Registry] [Shortcuts] If,%CheckBox_SM%,Equal,True,Add_Shortcut,StartMenu,%TextBox_SMN%,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN% If,%CheckBox_DT%,Equal,True,Add_Shortcut,Desktop,,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN% If,%CheckBox_RP%,Equal,True,Begin If,%CheckBox_DT%,Equal,True,Add_Pin,RecentPrograms,,$Desktop%TextBox_SCN%.lnk
Else,If,%CheckBox_SM%,Equal,True,Add_Pin,RecentPrograms,,$Start_MenuPrograms%TextBox_SMN%%TextBox_SCN%.lnk
End If,%CheckBox_Startup%,Equal,True,AddAutoRun,%TextBox_SCN%,%PE_Programs%%ProgramFolder%%ProgramExe%,,1

This is what I put into RoyM's batch file which I called Myapp.cmd

@echo off
echo.
echo.
echo Running Myapp program ...
echo.
echo.
cd /D Y:ProgramsMyapp
set Path=%Path%;Y:ProgramsMyapp
Y:ProgramsMyappMyapp.exe

Happy scripting everyone :D

Edited by vant, 08 May 2012 - 12:10 PM.


#16 vant

vant
  • Members
  • 9 posts
  •  
    Australia

Posted 08 May 2012 - 12:20 PM

Hi RoyM & ChrisR,

Many thanks for your responses. They've been really helpful. I've managed to combine ChrisR's skeleton script + RoyM's batch file and FINALLY got everything working... Yippee!!

Here're my step-by-step instructions to auto start a standalone application in WinPE.

Step 1: Requirements

a) ChrisR's skeleton script
B) RoyM's batch file
c) your application + configure files

Step 2: Where to put these files

- ChrisR's skeleton script will go under directory C:Win7PE_SE_20120416ProjectsWin7PE_SEAppsPortable
- RoyM's batch file will need to be encoded into ChrisR's skeleton script
- Put your application + configure files under directory C:Win7PE_SE_20120416ProjectsWin7PE_SEAppsPortablePstartMyappMyapp.exe + configure files

Step 3: Open Win7PESE80_Builder.exe and under Apps -> click on "Portable" -> then click on "Myapp".

Step 4: You need to encode RoyM's batch file into ChrisR's skeleton script by clicking on that tiny "Edit" button (the icon looks like a spanner).
Click on "Attachments" -> click "Add.."-> click "+Add.." to locate where you put RoyM's batch file -> finally clicks "Start" to encode the batch file into the script.

Step 5: Click "Source" -> then click the "green arrow" button to compile it.

Step 6: Go back to the main page and press the "BLUE Play" button to generate ISO and burn onto DVD.

Step 7: Boot up into the WinPE operating system and the auto boot should start your application

I made a few minor changes to ChrisR's skeleton script to load up RoyM's batch file


[Variables]

%ProgramEXE%=Myapp.cmd		 <<<<<<<<<<<<<<<<<<<<<<<<< I made the change here to load up RoyM's batch file

%ProgramFolder%=Myapp

%ProgramTitle%=MyTitle



[Interface]

ScrollBox_RunFromWhere="Run from RAM",1,4,4,9,148,21,"Run default","Run from RAM","Run from CD"

pBevel1=pBevel1,1,12,4,38,148,167

CheckBox_SM="Start menu shortcut",1,3,8,42,122,18,True

CheckBox_DT="Desktop shortcut",1,3,8,61,122,18,False

CheckBox_RP="Recent Programs",1,3,8,80,122,18,True

TextBox_SMN="Start Menu folder:",1,0,10,117,136,21,Myapp

TextBox_SCN="Name for Shortcuts:",1,0,10,154,136,23,MyName

CheckBox_Startup="AddAutorun MyaApp",1,3,10,182,138,18,True



[Process] Echo,"Processing %ScriptTitle%..."

StrFormat,REPLACE,%ScrollBox_RunFromWhere%," ","",%runfrom%

If,Not,%runfrom%,Equal,Rundefault,Call,VariableToMacro,%runfrom%,True

//-

Run,%ScriptFile%,Extract

//-

Run,%ScriptFile%,Registry

//-

Run,%ScriptFile%,Shortcuts



[Extract]

If,Not,ExistDir,%Target_Prog%%ProgramFolder%,DirMake,%Target_Prog%%ProgramFolder%

ExtractFile,%ScriptFile%,MyFolder,Myapp.exe,%Target_Prog%%ProgramFolder%



[Registry]



[Shortcuts]

If,%CheckBox_SM%,Equal,True,Add_Shortcut,StartMenu,%TextBox_SMN%,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN%

If,%CheckBox_DT%,Equal,True,Add_Shortcut,Desktop,,%PE_Programs%%ProgramFolder%%ProgramExe%,%TextBox_SCN%

If,%CheckBox_RP%,Equal,True,Begin If,%CheckBox_DT%,Equal,True,Add_Pin,RecentPrograms,,$Desktop%TextBox_SCN%.lnk

  Else,If,%CheckBox_SM%,Equal,True,Add_Pin,RecentPrograms,,$Start_MenuPrograms%TextBox_SMN%%TextBox_SCN%.lnk

End

If,%CheckBox_Startup%,Equal,True,AddAutoRun,%TextBox_SCN%,%PE_Programs%%ProgramFolder%%ProgramExe%,,1


This is what I put into RoyM's batch file which I called Myapp.cmd

@echo off

echo.

echo.

echo  Running Myapp program ...

echo.

echo.

cd /D Y:ProgramsMyapp

set Path=%Path%;Y:ProgramsMyapp

Y:ProgramsMyappMyapp.exe

Happy scripting everyone :D

#17 homes32

homes32

    Silver Member

  • .script developer
  • 942 posts
  • Location:Minnesota
  •  
    United States

Posted 08 May 2012 - 01:13 PM

Glad you were able to get everything working! In the future please wrap your code in CODE (the <> button in the editor toolbar) tags as it makes everything much easier to read and keeps posts neat.

regards,
Homes32

#18 RoyM

RoyM

    Frequent Member

  • .script developer
  • 345 posts
  • Interests:Component level repair, Micro-processor based equipment. Computer Repair + Custom Builds.
    (ie. Game Machines, Custom Firewalls\Smoothwalls)
    Network Penetration and testing, Including Wireless.
    Fishing, Hunting, Camping, Gaming.
  •  
    United States

Posted 10 May 2012 - 12:21 AM

Sorry for late response!
Glad it works, and thanks for posting a mini-tutorial to benefit others.

RoyM




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users