Jump to content
Sign in to follow this  
Britbadboy

System Startup

Recommended Posts

Britbadboy

Hi,

I am making a piece of code to install 2 various softwares. The problem is ths system needs a startup after the first installation. So was wondering is there a way that the AutoIT script can load as system boots up?

Thanks for your help, which will be much appreciated.

regards,

BadBoy.

Share this post


Link to post
Share on other sites
Coffee

Probably the easiest way is to just put it into the startup directory:

%windir%\Start Menu\Programs\StartUp

and then delete manually after it is done since it is physicaly located there and it cannot delete itself, being sure to create an .ini or other method to let your program check to see if the system has rebooted first to know where to start in your program, ie. pickup where you left off.

To circumvent all that you could have it start up from the registry and then remove that entry after it is completed if your comfortable with that.

If you want to use the startup method I suggested(safter) you could use ezzetabi's udf to delete it from the starup folder after your done.

runassvc stuff might be also useful to you if it applies in this thread

edit: better yet follow Henrik's advice below. Need to drink more of my nick :idiot:

Edited by Coffee

Share this post


Link to post
Share on other sites
Henrik

Probably the easiest way is to just put it into the startup directory:

%windir%\Start Menu\Programs\StartUp

and then delete manually after it is done since it is physicaly located there and it cannot delete itself

<{POST_SNAPBACK}>

Or put a shortcut to the script in the startup dir, then the script can delete the shortcut when done.

Ignorance is strength.

Share this post


Link to post
Share on other sites
Britbadboy

Probably the easiest way is to just put it into the startup directory:

%windir%\Start Menu\Programs\StartUp

and then delete manually after it is done since it is physicaly located there and it cannot delete itself, being sure to create an .ini or other method to let your program check to see if the system has rebooted first to know where to start in your program, ie. pickup where you left off.

Hi there,

please if you can suggest a snippet of code that can do this... please!??? I am no expert in this AutoIT and still trying to get my hands around it ..... so a lil more explaining will do bigg time good to me.....

regards,

BadBoy.

Share this post


Link to post
Share on other sites
Guest thomas20902

You can use the Runonce from the registry. Just add a command in the below registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce

Share this post


Link to post
Share on other sites
Guest Guidosoft

Ok, maybe you don't know what there saying:

I don't know if you understand the registry that well, so I will just tell you to follow these steps.

1. Click start, Programs.

2. Right click, Startup and click open

3. Move/Copy/Shortcut your script to the startup folder.

If this doesn't work, compile your script and try again.

This is the same as what they were saying only I made it nice and simple for a person that doesn't even know what a file path is. No offense.

Now, I would go with the registry method if you want to only run it once. I am going to make a newbiepack.AU3 include file anyway to make life much easier in handling simple things like this.

Edited by Guidosoft

Share this post


Link to post
Share on other sites
Coffee

put all scripts in a folder and compile in order:

1. program1.au3

2. program2.au3

3. installer1.au3

4. installer2.au3

5. myprog.exe

Run myprog.exe

Warning: This is an actual installer no phonie stuff to avoid a real reboot and fake the demostration comment out block 1 in intaller1.au3 and un comment block 2 to make a fake reboot.

Be sure to close all running programs/internet if neccisary before running blah blah

After completion of the demo,

Be sure to delete program1.exe and program2.exe from the temp directory to insure a sucessful second run if you wish to see it work again.

;program1.au3
MsgBox(0, "program1", "I am fake program number one" & @CRLF _ 
& "I represent all the spyware your probably installing")

;program2.au3
MsgBox(0, "program2", "I am a fake program number two, I am a meat popsicle")

;installer1.au3
;#cs
;comment this block out to try this exaple without actually rebooting
MsgBox(0, "Installer1", "HI!, I'm installer1, I will now install program1.exe to the temp dir")
FileInstall("program1.exe", @tempdir & "\Program1.exe")
MsgBox(0, "Finished", "installation is complete, your system will now reboot")
ProcessClose("myprog.exe")
Shutdown(6)
;#ce

;uncomment the lines below to do a fake reboot insead
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#cs
MsgBox(0, "Installer1", "HI!, I'm installer1, I will now install program1.exe to the temp dir")
FileInstall("program1.exe", @tempdir & "\Program1.exe")
Msgbox(0, "Installer1", "Installation is complete" & @crlf _
& "We will now simulate a reboot without actually doing it")
ProcessClose("myprog.exe")
Msgbox(0, "Installer1", "Reboot complete, welcome to windows")
run("myprog.exe")
#ce

;installer2.au3
MsgBox(0, "Installer2", "HI!, I'm installer2, I will now install program2.exe to the temp dir")
FileInstall("program2.exe", @TempDir & "\program2.exe")
MsgBox(0, "Finished", "Installation of program2.exe to the temp dir is complete!")

;myprog.exe
If Not FileExists(@StartupDir & "\myprog.lnk") Then
FileCreateShortcut(@ScriptDir & "\myprog.exe",@StartupDir & "\myprog.lnk")
MsgBox(0, "", "we have made a shortcut to this program in the startup directory to run on reboot")
EndIf


While 1
Select
Case FileExists(@TempDir & "\program1.exe") 
    MsgBox(0, "", "The install program has determined that you have already installed program1" & @CRLF _
    & "Now we will check if same is true for program2")
    install2()
    ExitLoop
 Case Not FileExists(@TempDir & "\program1.exe")
   RunWait(@scriptdir & "\installer1.exe")
   Exitloop
 EndSelect
Wend
    
    
Func install2()
    RunWait(@scriptdir & "\installer2.exe")
    FileDelete(@StartupDir & "\myprog.lnk")
    MsgBox(0, "Your Done!", "Congrats! Both programs have been installed" & @CRLF _
    & "myprog.lnk has also been removed from the startup dir")
   MsgBox(0,"Footnotes", "For fun you can navigate to your temp directory and run these programs" & @CRLF _
    & "Their names are:" & @CRLF & @CRLF & "program1.exe and program2.exe" & @CRLF & @CRLF _
    & "HAVA A NICE DAY!")
    EndFunc
Edited by Coffee

Share this post


Link to post
Share on other sites
Coffee

Letting us know what you want to install might help us to help you automate the intall process you will have to go through for your particular apps too. Or even to help you write up a nice fancy gui if your comfortable in that area, or a more silent option.

Share this post


Link to post
Share on other sites
Nova

If your user account has enough premissions to write to the reg

You could add a value to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Heres an example

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","My Script","REG_SZ","C:/My Script.exe")

Edit:Dose anyone know how to make a program be the first thing to run on windows startup ?

Ive noticed that some adware removal tools have options where you can make them run as the first program when windows starts even before explorer.exe is run ,so they are run before the adware gets a chance to run and the adware can be deleted sucessfully because it is not running !

So what im really asking is dose anyone know a way of making an exe run as the first program to be run at startup !

Edited by nova

Share this post


Link to post
Share on other sites
ezzetabi

There is a key that works in Win2000/XP (I did not test in older version).

More info here. You have to be admin.

Edited by ezzetabi

Share this post


Link to post
Share on other sites
Nova

I cant find the key Userinit it isnt listed in the expanded tree list I get from

HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon

My os is winxp pro

Edited by nova

Share this post


Link to post
Share on other sites
Nova

Any adviceezzetabi ?

u say u have tested this on win xp !

Share this post


Link to post
Share on other sites
Nova

Ok I found the key HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\Winlogon\Userinit

and I edited it :idiot:

But in my haste, I made a very very stupid mistake,and the result of this mistake locked me out of my laptop.

Every time windows loaded up, when I logged into any user account I got as far as the message logging on.... then the (windows starting sound plays) the about 1 second later before the starting sound even finishes, I get the msg logging off......then the (windows exiting sound plays)

Funny right ? :D

This made it impossible to log into any account ! The only way of fixing my laptop was I felt through msdos, seeing as my filesystem was ntfs I had to go find and download ntfsdos pro,once I got into dos I realised I dont know how to edit that registry key back to its origional value from dos.

So I gave up ,formatted (fat32 this time) and reinstall win xp pro (been thinking bout doing it for a while anyway)

Long story short if anyone else is thinking about messing with the preset stages involved with the running of the shell (explorer.exe)

Take my advice and ,take your time,dont make stupid mistakes just becasue your microwave is beeping at you telling you that ur lunch is ready dosent mean you should blindly hit restart not double checking what new value you have entered into a very important key in the regestry and then leave the room foaming at the mouth :lol:

Edit:By the way if anyone has suggestions as to how else I could have fixed this problem,im very intrested to hear ur ideas.

Edited by nova

Share this post


Link to post
Share on other sites
t0ddie

in safe mode, no programs start.

also, in dos, you can delete the file if you know the path.

2 options besides reformatting.

EDIT: always make a backup

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
this-is-me

HAHA. This is not any surprise to me, but I thought I would let you go on about your business and let you make your own mistakes:

Mistake 1 - Not knowing enough about windows to make an informed decision

Mistake 2 - Underestimating the power of the registry

Mistake 3 - Reinstalling Windows without asking for help before

Ezzetabi's mistake - recommending a method that he/she was not familiar with his/herself enough to know the rammifications of a wrong value. Any of the other run keys, including the startup item in the start menu would have simply given a "file not found" error and continued.

Therefore, ezzetabi should be reprimanded for not leading you down the right path, and you should be reprimanded for not letting someone help you before reinstalling windows. However, on your part, the lesson of having to (in your mind only) reinstall windows has taught you (as you stated) to be very careful.

Edited by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites
t0ddie

lol @ he/she

maybe its both? lol

not its fault though :idiot:

you cant hold everyones hand, and SOMEONE has to take responsibility for their own actions.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites
CyberSlug

By the way if anyone has suggestions as to how else I could have fixed this problem,im very intrested to hear ur ideas.

<{POST_SNAPBACK}>

The first thing I'd try is safe mode. If that didn't work, you could fix the registry with either:

Offline NT Password & Registry Editor with instructions here. OR BartPE with RegeditPE plugin.

If you only had access to your own computer and the original XP CD, then a XP Repair Installation would probably fix the problem.


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
lyledg

Could have also used ERD commander 2003, the CD is bootable and has the ability to reset the password etc as well as edit the resgitry key that went missing :idiot:

Share this post


Link to post
Share on other sites
Nova

I did try a few of ur ideas before format and they didnt work.

Heres a short list !

Logged in under Safe mode - same thing happened.

I did delete the file from dos - same thing happened.

Have heard of ERD commander 2003 before but could never find a free copy.

Im pretty sure CyberSlugs idea is the only one which could have helped in that situation.

Anyway I was quite happy to start fresh as I said Ive been meaning to do a huge clean up for ages anyway.

If being more carefull in the future, is the only thing I get out of all this, then I think it was worth it :idiot:

Edited by nova

Share this post


Link to post
Share on other sites
MHz

Recovery Console is for these situations.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×