Jump to content

Auto Start Script


anixon
 Share

Recommended Posts

Need some help with this one. I have a shortcut to a script in the users 'documents and settings\user\start menu\startup' to automatically start on a warm or cold boot. After the script is launched how do I stop it from executing its process until Windows XP has finished starting all services and programs it processes in Startup?

Link to comment
Share on other sites

Need some help with this one. I have a shortcut to a script in the users 'documents and settings\user\start menu\startup' to automatically start on a warm or cold boot. After the script is launched how do I stop it from executing its process until Windows XP has finished starting all services and programs it processes in Startup?

Try putting Sleep(20000) at the beginning of the script. That will pause your script for 20 seconds. Trial and error to get the time right. If you have anyway of knowing what the last or close to last process will be you could also try ProcessWait Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Try putting Sleep(20000) at the beginning of the script. That will pause your script for 20 seconds. Trial and error to get the time right. If you have anyway of knowing what the last or close to last process will be you could also try ProcessWait

I have written this sleep statement so that I can change the time delay in an INI file without having to change and recompile the script.

$var4 = IniRead(@ScriptDir&"\nameofscript.ini", "countdown", "countd", "10")

$t = 0

Do

sleep(1000)

$t = $t + 1

Until $t = $Var4

A preferred process would be to have a delay based on waiting for is the 'Wireless Network Connection with Status = 'Connected' to occur

Cheers :"> Ant

Link to comment
Share on other sites

I have written this sleep statement so that I can change the time delay in an INI file without having to change and recompile the script.

$var4 = IniRead(@ScriptDir&"\nameofscript.ini", "countdown", "countd", "10")

$t = 0

Do

sleep(1000)

$t = $t + 1

Until $t = $Var4

A preferred process would be to have a delay based on waiting for is the 'Wireless Network Connection with Status = 'Connected' to occur

Cheers :"> Ant

Get the pid of the process (I think it's a service) and use

Do

Sleep(1000)

Until ProcessExists(PID)

Someone also posted a script to determine if there is an active internet connection. You could try that.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Get the pid of the process (I think it's a service) and use

Do

Sleep(1000)

Until ProcessExists(PID)

Someone also posted a script to determine if there is an active internet connection. You could try that.

Could not find the script that you mentioned.

This is probably a solution which gets the public IP address or returns -1

#include <Inet.au3>

$PublicIP = _GetIP()

MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP)

If you start the script with no network connectivity and you then repair the network connection while routine does detect the public IP address and break out of the loop.

This does not work

#include <Inet.au3>

$PublicIP = _GetIP()

while 1

if $PublicIP = -1 then

MsgBox(0, "IP Address", "You are not connected")

Sleep(1000)

end if

wend

MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP)

exit

This works

$IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)

while $iscon[0] = 0

Sleep(1000)

$IsCon=DllCall("WinInet.dll","int","InternetGetConnectedState","int_ptr",0,"int",0)

wend

MsgBox(0, "Network connected:",$iscon[0])

exit

Edited by anixon
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...