Sign in to follow this  
Followers 0
hambaba

Reboot and continue with script

3 posts in this topic

I am trying to write a scripte that does the following steps

Installs a package.

Reboots

Unistalls the same package.

Reboots

repeats the above steps.

can anyone help me with the reboot section of the code, How would the script continue after the system reboot?

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

To do this, the easiest way I think would be to hook up your autoit script to a database, (mysql is what I use) then have it mark a specific field with a certain value when the program installation is completed... then you just set the autoit script to automatically play when windows starts and have it check the field value in the database, set it so when it retrieves that field it then performs the specific action (to install the software again) This would loop continuously so its, for example, setting the field to 0 then 1, then 0 then 1, and so on each time so it keeps looping

Edited by utahwebdev

Share this post


Link to post
Share on other sites

I am trying to write a scripte that does the following steps

Installs a package.

Reboots

Unistalls the same package.

Reboots

repeats the above steps.

can anyone help me with the reboot section of the code, How would the script continue after the system reboot?

The usual way to do this is to use the registry for RunOnce.

RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "!SomeRef", "REG_SZ", "C:\SomeFolder\someapp.exe")

The exclamation mark at the start of the ref tells Windows not to remove the key unless the program to be run has actually been started. Otherwise, if Windows shuts down for some reason before the app runs then the reg key will still be removed and the app will never be run.

When the someapp.exe ends, before it hsuts windows down, it can write the registry value with the exe to do the next job.

This is the way, for example, that you can clean up after uninstalling an application and leave no trace of it.

Eg

RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce", "!MyAppClear", "REG_SZ", "Command.com /c del " & @TempDir & "\lasttrace.txt")

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  
Followers 0