Sign in to follow this  
Followers 0
chiners_68

Autoit scripts at runonce

25 posts in this topic

will autoit scripts execute at runonce in windows XP..?

Share this post


Link to post
Share on other sites



No reason they shouldn't

Just add them to the runonce key in the registry


----[ SandyD ]---

Share this post


Link to post
Share on other sites

have done that along with all my apps I install, but it not worky.

Share this post


Link to post
Share on other sites

Any error messages?

Does the script run fine when executed normally?


----[ SandyD ]---

Share this post


Link to post
Share on other sites

its a GUI script which runs defrag automatically after 6 seconds.

it works fine in windows but not at runonce.

Share this post


Link to post
Share on other sites

Just out of interest, put a sleep delay of about 1 minute before any of your code (top line)

That way the PC will have time to get itself sorted before running the script.

Try it and see if that helps ...


----[ SandyD ]---

Share this post


Link to post
Share on other sites

Just out of interest, put a sleep delay of about 1 minute before any of your code (top line)

That way the PC will have time to get itself sorted before running the script.

Try it and see if that helps ...

ive tried it in HKLM runonce & runonceEX but it wont run. ive also tried in HKCU rinonce which runs once into windows but this dosent run either.

the script is compiled to defrg.exe in the windows\system32 directory. it runs in windows but not in any runonce.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Need more information.

1. Does the au3 scripts run when double clicked from explorer?

2. What is the command being used to add the entry into the registry?

Edited by MHz

Share this post


Link to post
Share on other sites

Here is the script

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$started = 1

$mainwindow = GUICreate("Defragmentation", 200, 100)

GUICtrlCreateLabel("Automating defrag in 6 seconds", 30, 10)

$btnExit = GUICtrlCreateButton("Skip", 70, 50, 60)

;GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

GUICtrlSetOnEvent($btnExit, "_Terminate")

GUISetState(@SW_SHOW)

While 1

Sleep(6000)

If $started Then

Run("defrag.exe c: -f", "", @SW_HIDE)

EndIf

Exit

Wend

Func _Terminate()

$started = 0

Exit

EndFunc

here is runonce

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%02 /VE /D "BTS Driver Pack Finisher" /f

REG ADD %KEY%02 /V 1 /D "%SystemDrive%\DPsFnshr.exe" /f

REG ADD %KEY%02 /V 2 /D "reschangecon.exe -width=1024 -height=768 -depth=32" /f

REG ADD %KEY%15 /VE /D "McAfee VirusScan Enterprise 8.0" /f

REG ADD %KEY%15 /V 1 /D "%systemdrive%\install\VE8.0iPatch13\setup.exe /qb" /f

REG ADD %KEY%15 /V 2 /D "%systemdrive%\install\sdat4944.exe /silent" /f

REG ADD %KEY%25 /VE /D "Adobe Reader 8.0" /f

REG ADD %KEY%25 /V 1 /D "%systemdrive%\install\reader8.exe" /f

REG ADD %KEY%50 /VE /D "Macromedia Shockwave 10.0.1" /f

REG ADD %KEY%50 /V 1 /D "%systemdrive%\install\Shockwave10.exe" /f

REG ADD %KEY%60 /VE /D "Cleanup" /f

REG ADD %KEY%60 /V 1 /D "REGEDIT /s %WINDIR%\system32\regcleanup.reg" /f

REG ADD %KEY%60 /V 2 /D "%WINDIR%\system32\cleanup.cmd" /f

REG ADD %KEY%70 /VE /D "Defragmentation" /f

REG ADD %KEY%70 /V 1 /D "%WINDIR%\system32\defrg.exe" /f

REG ADD %KEY%70 /V 2 /D "%WINDIR%\system32\defrg.exe" /f

REG ADD %KEY%90 /VE /D "Restarting Computer" /f

REG ADD %KEY%90 /V 1 /D "%WINDIR%\system32\restart.cmd" /f

runonce works fine. i use to use a js script for the defrag but it didnt have the GUI i wanted thus the reason for creating one in Autoit. If i have no success ill go back to my js version.

Share this post


Link to post
Share on other sites

Your missing a backslash in your cmd file. Notice the KEY Environmental Variable change.

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%02 /VE /D "BTS Driver Pack Finisher" /f
REG ADD %KEY%02 /V 1 /D "%SystemDrive%\DPsFnshr.exe" /f
REG ADD %KEY%02 /V 2 /D "reschangecon.exe -width=1024 -height=768 -depth=32" /f

REG ADD %KEY%15 /VE /D "McAfee VirusScan Enterprise 8.0" /f
REG ADD %KEY%15 /V 1 /D "%systemdrive%\install\VE8.0iPatch13\setup.exe /qb" /f
REG ADD %KEY%15 /V 2 /D "%systemdrive%\install\sdat4944.exe /silent" /f

REG ADD %KEY%25 /VE /D "Adobe Reader 8.0" /f
REG ADD %KEY%25 /V 1 /D "%systemdrive%\install\reader8.exe" /f

REG ADD %KEY%50 /VE /D "Macromedia Shockwave 10.0.1" /f
REG ADD %KEY%50 /V 1 /D "%systemdrive%\install\Shockwave10.exe" /f

REG ADD %KEY%60 /VE /D "Cleanup" /f
REG ADD %KEY%60 /V 1 /D "REGEDIT /s %WINDIR%\system32\regcleanup.reg" /f
REG ADD %KEY%60 /V 2 /D "%WINDIR%\system32\cleanup.cmd" /f

REG ADD %KEY%70 /VE /D "Defragmentation" /f
REG ADD %KEY%70 /V 1 /D "%WINDIR%\system32\defrg.exe" /f
REG ADD %KEY%70 /V 2 /D "%WINDIR%\system32\defrg.exe" /f

REG ADD %KEY%90 /VE /D "Restarting Computer" /f
REG ADD %KEY%90 /V 1 /D "%WINDIR%\system32\restart.cmd" /f

Share this post


Link to post
Share on other sites

cant see anything missing..? can you highlight im blind..lol

Share this post


Link to post
Share on other sites

You need to have a trailing backslash to create the numbers keys under the RunOnceEx key.

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\

Before in registry

RunOnceEx
RunOnceEx01
RunOnceEx02
RunOnceEx03

After in registry with change

RunOnceEx
- 01
- 02
- 03

Without the backslash, then keys were being created outside of the RunOnceEx key rather then inside the RunOnceEx key.

:)

Share this post


Link to post
Share on other sites

ill add it but the key creates fin. ive run the batch file & checked the keys exist. the rest of the runonce runs ok its just the defrg.exe that dosent run.

Share this post


Link to post
Share on other sites

change this

Run("defrag.exe c: -f", "", @SW_HIDE)
oÝ÷ ÚÚ-+ºÚ"µÍBT[ØZ]
    ][ÝÙYYË^HÎY][ÝË   ][ÝÉ][ÝËÕ×ÒQJB

so the script waits for defrag.exe to finish defragging the drive.

Share this post


Link to post
Share on other sites

REG ADD %KEY%70 /VE /D "Defragmentation" /f

REG ADD %KEY%70 /V 1 /D "%WINDIR%\system32\defrg.exe" /f

REG ADD %KEY%70 /V 2 /D "%WINDIR%\system32\defrg.exe" /f

Miss spell defrg.exe it shoulbe defrag.exe also you are missing the drive to defrag.

REG ADD %KEY%70 /VE /D "Defragmentation" /f

REG ADD %KEY%70 /V 1 /D "%WINDIR%\system32\defrag.exe %SystemDrive%" /f

REG ADD %KEY%70 /V 2 /D "%WINDIR%\system32\defrag.exe %SystemDrive%" /f


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Miss spell defrg.exe it shoulbe defrag.exe also you are missing the drive to defrag.

Nah, that is the AutoIt script, not defrag.exe.

Share this post


Link to post
Share on other sites

MHZ,

its not Run("defrag.exe c: -f", "", @SW_HIDE) line which is a problem. the GUI before this part of the script runs dosent run itself. works fine in windows.

Danny35D,

im not running microsft defrag direct. ive got an autoit script callded defrg.exe which brings up a GUI for 6 seconds before it runs defrag.exe.

its still not working with the backslash added to the runonce.

Share this post


Link to post
Share on other sites

Change it to RunWait. Everything looks ok at another glance. Perhaps Danny35D can see what I cannot. :)

Share this post


Link to post
Share on other sites

runwait is no good it pauses the GUI

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

runwait is no good it pauses the GUI

Yes, and stops your next entry in RunOnceEx running if your script exits before defrag.exe finishes. You can hide your gui or delete it before the RunWait if you do not want to see the Gui anymore. But your script needs to run while defrag.exe does. Edited by MHz

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