Jump to content











Photo

How to use autoruns.script


  • Please log in to reply
36 replies to this topic

#1 pscEx

pscEx

    Platinum Member

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

Posted 23 October 2006 - 09:32 AM

Let me first repeat some content of this post:

The new AutoRuns.Script is not longer running directly inside the project build.
Every script which wants to add something to autorun, has to call autorun.script by
Run,%AutoRunScript%,Add,myCommandLine

The Add section checks whether autorun.cmd already exists inside the target.
If not, it creates it, makes the registry entry for RunOnceEx and copies the necessary files to the target.

Then it creates the new entry in autorun.cmd

[Add]

If,ExistFile,%AutoRunFile%,TXTAddLine,%AutoRunFile%,"#1","Append"

If,NotExistFile,%AutoRunFile%,Run,%AutoRunScript%,Create,"#1"



[Create]

FileCreateBlank,%AutoRunFile%

TXTAddLine,%AutoRunFile%,"#1","Append"

Echo,"Copying files..."

ExtractAllFiles,"%AutoRunScript%","Folder","%TargetDir%\i386\system32"

RegHiveLoad,"Tmp_software","%TargetDir%\i386\system32\config\software"

RegWrite,"HKLM",0x1,"Tmp_software\Microsoft\Windows\CurrentVersion\RunOnceEx\500","200","hiderun.exe autorun.cmd"

RegHiveUnLoad,"Tmp_software"
Currently the new autoruns functionality is stored in the sandbox.

For .script developers:

To use the new functionality demands that the developers must change their scripts to bring autoruns work with them. Mainly this is to show shortcuts.

Old lines

TXTAddLine,"%TargetDir%\i386\system32\autorun.cmd","my line","Append"
have to be replaced by
Run,%AutoRunScript%,Add,"my line".
If there is a line like:
If,NotExistFile,"%Target%\system32\autorun.cmd",FileCreateBlank,"%Target%\system32\autorun.cmd"
delete this line.

For 'normal' users:
If you use the sandbox content for your WinBuilder installation and download a script from outside the sandbox which does not fullfill this reqirement: There may be some troubles!


Peter

#2 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 23 October 2006 - 02:07 PM

Isn't this solution way to complex and inconvenient to developers :P
Simpler:
- always create empty AUTORUN.CMD along with directories
- still use same TxtAddLine
Of course, FileCreateBlank should not misbehave :P
:P
Alexei
PS
In general, such changes (that require developers to make massive updates to their scripts :P ) should be approved by community.
How should we like updating script back and force to run it in two sand boxes?
Are you sure your new feature is fully compatible?
What if developer mislooked the change or just did'd read your post?
:P

#3 pscEx

pscEx

    Platinum Member

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

Posted 23 October 2006 - 02:12 PM

Isn't this solution way to complex and inconvenient to developers :P
Simpler:
- always create AUTORUN.CMD along with directories
- still use same TxtAddLine
- at the end: compare AUTORUN.CMD with empty file and if not, add reg entry
Of course, FileCreateBlank should not misbehave :P
:P
Alexei

Looks good in the first view. :P
But in the second view: There are also some registry entries made.
Also RegDelete... if necessary? :P

Peter

#4 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 23 October 2006 - 02:31 PM

Looks good in the first view. :P
But in the second view: There are also some registry entries made.
Also RegDelete... if necessary? :P
Peter

AUTORUN.CMD is created by "make directories".
No registry adds until the build is done, then add registry entry only if AUTORUN.CMD is not empty. :P
Alexei

#5 smiley

smiley

    Silver Member

  • .script developer
  • 905 posts
  •  
    Greece

Posted 23 October 2006 - 02:41 PM

There is a much simpler solution: To store the contents of shortcuts and autorun in the registry just like xpeloder but this will solve ALL the compatibilities problems once and for all. Of course it needs some coding but I believe that someone will achive that.

The files autoruns.bat and shortcuts.ini will no more be used.

#6 pscEx

pscEx

    Platinum Member

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

Posted 23 October 2006 - 03:08 PM

There is a much simpler solution: To store the contents of shortcuts and autorun in the registry just like xpeloder but this will solve ALL the compatibilities problems once and for all. Of course it needs some coding but I believe that someone will achive that.

The files autoruns.bat and shortcuts.ini will no more be used.


Im think you mean: Using Registry Run / RunOnce / RunOnceEx.

Generally: That really is the best way! :P
At least autorun.cmd can be replaced by such registry entries.

I already thought earlier about that.
I also thought about that the shortcuts can be created by the script and written directly into target.

But I did not find out how the create a shortcut from command line. Everything what I found was calling the shortcut wizzard. :P

Maybe somebody else knows how to create a shortcut by command line?

Peter

#7 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 23 October 2006 - 03:43 PM

Im think you mean: Using Registry Run / RunOnce / RunOnceEx.

Generally: That really is the best way! :P
At least autorun.cmd can be replaced by such registry entries.

I already thought earlier about that.
I also thought about that the shortcuts can be created by the script and written directly into target.

But I did not find out how the create a shortcut from command line. Everything what I found was calling the shortcut wizzard. :P

Maybe somebody else knows how to create a shortcut by command line?

Peter

There are many ways to create shortcut :P
- create link-file from the program (its structure is rather simple, I saw it somewhere on the web...).
- create MS INF execute it at runtime (INFs can make shortcuts).
- create it manually on your PC, change the path to "%SystemRoot%\...", then encode it into script.
- make from program, see http://www.codeproje...32/makelink.asp
- use freeware utility http://www.optimumx....nload/#Shortcut
- simple VBS script can do it (I believe it's public domain)
Set Args = Wscript.Arguments

'---Wscript.Echo "Location=" & args(0) & args(1) & ".lnk"

'---Wscript.Echo "  Target=" & args(2)

'Create a WshShell Object

Set WshShell = Wscript.CreateObject("Wscript.Shell")

'Create a WshShortcut Object (location of the shortcut - first parameter)

set oShellLink = WshShell.CreateShortcut(args(0) & args(1) & ".lnk")

'Set the Target Path for the shortcut (location of the target - 3rd parameter)

oShellLink.TargetPath = args(2)

'Set the additional parameters for the shortcut (parameters)

'---oShellLink.Arguments =

'---oShellLink.WorkingDirectory =

'Set the additional parameters for the shortcut (Icon)

oShellLink.IconLocation = args(2) & ", 0"

'Save the shortcut

oShellLink.Save

'Clean up the WshShortcut Object

Set oShellLink = Nothing


#8 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 23 October 2006 - 03:53 PM

There is a much simpler solution: To store the contents of shortcuts and autorun in the registry just like xpeloder but this will solve ALL the compatibilities problems once and for all. Of course it needs some coding but I believe that someone will achive that.

The files autoruns.bat and shortcuts.ini will no more be used.

Not sure about registry :P Execution from registry may happen "too early" :P
BTW, there are very many places in registry from which you can run a program.
See this vb script: http://www.silentrun...ent Runners.vbs
:P
Alexei

#9 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10549 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 23 October 2006 - 04:09 PM

Isn't registry runonce/ex available only when using explorer as shell?

Wouldn't cmd.exe, xoblite and others be left out of this feature? :P

just a thought..

:P

#10 pscEx

pscEx

    Platinum Member

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

Posted 23 October 2006 - 04:10 PM

- create link-file from the program (its structure is rather simple, I saw it somewhere on the web...).

Alexei,
thanks for your research. :P
Most of your results I already googled and put into the recycle bin (out of somewhat reasons).
The VBS script I did not like because it demands the WindowsScriptingHost or something else installed. And, in my opinion, a Winbuilder script should never assume a certain software installed on the host! BTW: there are currently two .script developers using VB :P
I'm going to check whether the same can be done with Delphi.
@Nuno
???

That one mentioned above in the quote, seems very interesting. That is what I'v been looking for. :P
Can you remember how you found it?

Peter

#11 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 24 October 2006 - 11:56 PM

Let me first repeat some content of this post:

The new AutoRuns.Script is not longer running directly inside the project build.
Every script which wants to add something to autorun, has to call autorun.script by

Run,%AutoRunScript%,Add,myCommandLine

The Add section checks whether autorun.cmd already exists inside the target.
If not, it creates it, makes the registry entry for RunOnceEx and copies the necessary files to the target.

Then it creates the new entry in autorun.cmd

[Add]

If,ExistFile,%AutoRunFile%,TXTAddLine,%AutoRunFile%,"#1","Append"

If,NotExistFile,%AutoRunFile%,Run,%AutoRunScript%,Create,"#1"



[Create]

FileCreateBlank,%AutoRunFile%

TXTAddLine,%AutoRunFile%,"#1","Append"

Echo,"Copying files..."

ExtractAllFiles,"%AutoRunScript%","Folder","%TargetDir%\i386\system32"

RegHiveLoad,"Tmp_software","%TargetDir%\i386\system32\config\software"

RegWrite,"HKLM",0x1,"Tmp_software\Microsoft\Windows\CurrentVersion\RunOnceEx\500","200","hiderun.exe autorun.cmd"

RegHiveUnLoad,"Tmp_software"
Currently the new autoruns functionality is stored in the sandbox.

For .script developers:

For 'normal' users:
If you use the sandbox content for your WinBuilder installation and download a script from outside the sandbox which does not fullfill this reqirement: There may be some troubles!


Peter

So if I well understand this two line :

If,NotExistFile,"%TargetDir%\i386\system32\shortcut.inf",FileCreateBlank,"%TargetDir%\i386\system32\shortcut.inf"
TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!PE\Programs\IrfanView\i_view32.exe,!DE\Irfanview","Append"

must be write like this

Run,%AutoRunScript%,Add,"1,!PE\Programs\IrfanView\i_view32.exe,!DE\Irfanview"

We have juste one line now, is it correct ?

#12 pscEx

pscEx

    Platinum Member

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

Posted 25 October 2006 - 07:23 AM

We have juste one line now, is it correct ?

Yes, but remember to use #$q if there are spaces in the line!

Peter

#13 pscEx

pscEx

    Platinum Member

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

Posted 25 October 2006 - 01:43 PM

Yes, but remember to use #$q if there are spaces in the line!

Peter


Sorry, pedrole15!

I did not look carefully enough into your post. :P
You are mixing autoruns and shortcuts.

Of course you cannot replace your shortcuts lines by that what I suggested for autoruns! :P

Peter :P

#14 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 26 October 2006 - 10:04 AM

@Peter
If I could remember... :P So I had to try again and got it from the first attempt googling for shortcut "file structure" Enjoy :P http://www.mediasrv....nk/shortcut.pdf
However, you may need additional information from here http://msdn.microsof...ts/shortcut.asp
MS article above mentions calls to the "Shell link object" it may be worse a try to see which DLLs this object is using and call them directly.
:P
Alexei

#15 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 26 October 2006 - 10:28 PM

Sorry, pedrole15!

I did not look carefully enough into your post. :P
You are mixing autoruns and shortcuts.

Of course you cannot replace your shortcuts lines by that what I suggested for autoruns! :P

Peter :P

I have download today the Sandbox_Latest
I look at the script in the apps folder the code for the shortcut are stil the same so i haven't to change my script ?
Where can find a script with the new code ?

#16 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 27 October 2006 - 03:44 AM

@psc
Would you mind including "Changes.txt" into sandbox zip?
:P
Alexei

#17 pscEx

pscEx

    Platinum Member

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

Posted 27 October 2006 - 06:54 AM

I have download today the Sandbox_Latest
I look at the script in the apps folder the code for the shortcut are stil the same so i haven't to change my script ?
Where can find a script with the new code ?


I changed use of autoruns!
To use autoruns, before there was TxtAddLine, ... now there is Run,%AutoRunFile%, ...

I did not change use of shortcuts!
There is still a TxtAddLine, ...

Peter

#18 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 27 October 2006 - 08:00 AM

I changed use of autoruns!
To use autoruns, before there was TxtAddLine, ... now there is Run,%AutoRunFile%, ...

I did not change use of shortcuts!
There is still a TxtAddLine, ...

Peter

Incompatible :P and inconsistent :P
People are already :P :P :P :P
How to make them :P again?
I would vote to return to TxtAddLine (mostly because of #$q ).
Let's poll this issue!

Alexei :P

#19 pscEx

pscEx

    Platinum Member

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

Posted 27 October 2006 - 09:50 AM

Incompatible :P and inconsistent :P

Why?
That are two different scripts written by different people.
Peter

#20 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 27 October 2006 - 12:59 PM

Incompatible :P and inconsistent :P

Why?
That are two different scripts written by different people.
Peter

Here is my logic:
When we provide some working environment to others we should make it comfortable.
Developer feels comfortable when he has to follow relatively stable and simple rules.
Change of the rules creates frustration. Even more frustrating is replacing one simple rules with two complex.
We had simple rule: need autorun or shortcut - use TxtAdd
Now it becomes:
need autorun - use Run,%AutoRunScript%,Add,.... and don't forget about #$q
need shortcut - use TxtAdd and don't use #$q
That's harder to remember and follow, meaning more frustration (and less comfort).

In another words: You're wrote: X=a+b; Y=c+d; It was fine.
Now, you were told that syntax was changed and you have to replace Y=c+d; with Y=Sum(C,D); but leave X=a+b; as it was. You're saying: "it's incompatible and inconsistent!" and they ask you: "Why? Support for X and Y was written by different people."
What would you say?

You know, I can learn to live with it, but when I found others (pedrole15) to be confused I realized it should not be left as is. Really, look at your :P and :P in perious posts :P That's just the beginning :P

:P
Alexei

#21 phox

phox

    Silver Member

  • .script developer
  • 764 posts

Posted 27 October 2006 - 01:28 PM

Why?
That are two different scripts written by different people.
Peter
Here is my logic:
When we provide some working environment to others we should make it comfortable.
Developer feels comfortable when he has to follow relatively stable and simple rules.
Change of the rules creates frustration. Even more frustrating is replacing one simple rules with two complex.
We had simple rule: need autorun or shortcut - use TxtAdd
Now it becomes:
need autorun - use Run,%AutoRunScript%,Add,.... and don't forget about #$q
need shortcut - use TxtAdd and don't use #$q
That's harder to remember and follow, meaning more frustration (and less comfort).

In another words: You're wrote: X=a+b; Y=c+d; It was fine.
Now, you were told that syntax was changed and you have to replace Y=c+d; with Y=Sum(C,D); but leave X=a+b; as it was. You're saying: "it's incompatible and inconsistent!" and they ask you: "Why? Support for X and Y was written by different people."
What would you say?

You know, I can learn to live with it, but when I found others (pedrole15) to be confused I realized it should not be left as is. Really, look at your :P and :P in perious posts :P That's just the beginning :P

:P
Alexei


I fully agree!

In short and general:

Make it Simple,
make it Small,
to be Stable
and Superior!

#22 pscEx

pscEx

    Platinum Member

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

Posted 27 October 2006 - 02:36 PM

Why?
That are two different scripts written by different people.
Peter
Here is my logic:
When we provide some working environment to others we should make it comfortable.
Developer feels comfortable when he has to follow relatively stable and simple rules.
Change of the rules creates frustration. Even more frustrating is replacing one simple rules with two complex.
We had simple rule: need autorun or shortcut - use TxtAdd
Now it becomes:
need autorun - use Run,%AutoRunScript%,Add,.... and don't forget about #$q
need shortcut - use TxtAdd and don't use #$q
That's harder to remember and follow, meaning more frustration (and less comfort).

In another words: You're wrote: X=a+b; Y=c+d; It was fine.
Now, you were told that syntax was changed and you have to replace Y=c+d; with Y=Sum(C,D); but leave X=a+b; as it was. You're saying: "it's incompatible and inconsistent!" and they ask you: "Why? Support for X and Y was written by different people."
What would you say?

You know, I can learn to live with it, but when I found others (pedrole15) to be confused I realized it should not be left as is. Really, look at your :P and :P in perious posts :P That's just the beginning :P

:P
Alexei


Nice and good explained :P

My statement:

The only safe way is the logic of the current autoruns.


If, like with shortcuts, the developer has to create a blank file this is dangerous if this file does not belong to his script, but to the complete project.
If he writes into the non existing file, that is only his problem.
But if he resets an existing file by FileCreateBlank, this affects other scripts.
That was the reason for my changes of autoruns, where smiley as the author agreed.

@phox
Please think about adding one line into the middle of your signature:
make it Safe, :P

@all again:
If you look into some other posts, I suggested to do the same with shortcuts and asked smiley to agree. He answered 'why not?'
I did the changes and when I wanted to send them to sandbox I saw that the author was ove, and ove was not available.
So I deleted my changes.
Maybe I find it in my daily backup and can restore.
Maybe I recreate. This will take only about 30 minutes.
But I do not want to do so w/o ove's acceptance.

Peter

#23 phox

phox

    Silver Member

  • .script developer
  • 764 posts

Posted 27 October 2006 - 02:55 PM

@phox
Please think about adding one line into the middle of your signature:
make it Safe, :P


I could not: I don't have adequate Avatar to illustrate it (5S),
But I could change my Signature in:

Make it Simple,
make it Small,
to be Safe
and Superior!

if you think that it will better suite WinBilder.

#24 pscEx

pscEx

    Platinum Member

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

Posted 27 October 2006 - 03:02 PM

I could not: I don't have adequate Avatar to illustrate it (5S),
But I could change my Signature in:

Make it Simple,
make it Small,
to be Safe
and Superior!

if you think that it will better suite WinBilder.


It was just a joke. :P
But in my opinion the Safe has to have the highest priority for everybody in this forum.

Peter

#25 phox

phox

    Silver Member

  • .script developer
  • 764 posts

Posted 27 October 2006 - 03:25 PM

It was just a joke. :P
But in my opinion the Safe has to have the highest priority for everybody in this forum.

Peter


It is not a joke. I would like that 4S standard
describe WinBuilder in the best possible way.

Stable is very important, but Safe is even more.
As my Avatar allow only 4 “S” letters and “Safe”
incorporates “Stable”, maybe it’s time to change.

I go to walk my dog and think a little bit more!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users