EndFunc Posted November 10, 2009 Posted November 10, 2009 (edited) Ok,I've been trying to execute a script after you login to windows. Problem is when I do it using RunOnce registry settings it halts windows from loading the desktop until the script is executed. Normally thats not an issue but I need the desktop to load so that a window will open to finish an installation that required a reboot. I guess I could use a timer but either way it will halt the desktop from loading so I'm kind of stuck on how to get it run afterwards. If I don't put it in the RunOnce it won't execute at all on login. Any good suggestions? TIA Edited November 10, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it.
Developers Jos Posted November 10, 2009 Developers Posted November 10, 2009 (edited) Why not use a RUN registry entry in stead of RUNONCE? Jos Edited November 10, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
EndFunc Posted November 10, 2009 Author Posted November 10, 2009 Why not use a RUN registry entry in stead of RUNONCE?JosBecause I believe Run will execute everytime you login. I only need it to do it one time and that's it. Also not sure if Run will still wait for the script to run before loading the desktop still. Unless I delete the key after it does what it needs to. However I still don't know if Run will wait for the desktop to load like RunOnce does. EndFuncAutoIt is the shiznit. I love it.
Developers Jos Posted November 10, 2009 Developers Posted November 10, 2009 Because I believe Run will execute everytime you login. I only need it to do it one time and that's it. Also not sure if Run will still wait for the script to run before loading the desktop still. Unless I delete the key after it does what it needs to. However I still don't know if Run will wait for the desktop to load like RunOnce does.The times I ve done this was indeed using RUN and removing the Registry entry as first thing in the script and then Sleep() for a while to ensure the desktop was loaded and all services started.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
EndFunc Posted November 10, 2009 Author Posted November 10, 2009 The times I ve done this was indeed using RUN and removing the Registry entry as first thing in the script and then Sleep() for a while to ensure the desktop was loaded and all services started.JosYes I should have remembered that RUN will load the desktop due to all the programs I have that start while windows loads. DUH..lol but was trying to use the "correct" method rather than add and deleting keys, but if it works then who cares right? Thanks EndFuncAutoIt is the shiznit. I love it.
maverickschoice Posted May 24, 2011 Posted May 24, 2011 First time poster, long time watcher. Does anyone have any examples to accomplish this in W7. I have the same issue as the OP & is really bugging me. Cheers MC
MHz Posted May 24, 2011 Posted May 24, 2011 Hi maverickschoice, The HKLM RunOnce key will halt loading the Desktop until the data entries complete. The HKCU RunOnce key will continue loading the Desktop while processing the data entries. An example using the HKCU RunOnce key If Not @Compiled Then ; not compiled script will exit MsgBox(0, @ScriptName, 'Compile this script to test') Exit ElseIf Not $CMDLINE[0] Then ; add registry entry to run once the compiled script If RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce', _ 'test', 'REG_SZ', '"' & @ScriptFullPath & '" /restart') Then MsgBox(0, @ScriptName, 'This script has been added to the HKCU RunOnce key in the registry') EndIf ElseIf $CMDLINE[1] = '/restart' Then ; show msgbox which blocks and wait for desktop to load MsgBox(0, @ScriptName, 'Wait for the desktop to finish loading and then click OK') EndIfCompile the script. Run the compiled script and then reboot the PC to see the result.
maverickschoice Posted May 25, 2011 Posted May 25, 2011 Hi maverickschoice, The HKLM RunOnce key will halt loading the Desktop until the data entries complete. The HKCU RunOnce key will continue loading the Desktop while processing the data entries. An example using the HKCU RunOnce key If Not @Compiled Then ; not compiled script will exit MsgBox(0, @ScriptName, 'Compile this script to test') Exit ElseIf Not $CMDLINE[0] Then ; add registry entry to run once the compiled script If RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce', _ 'test', 'REG_SZ', '"' & @ScriptFullPath & '" /restart') Then MsgBox(0, @ScriptName, 'This script has been added to the HKCU RunOnce key in the registry') EndIf ElseIf $CMDLINE[1] = '/restart' Then ; show msgbox which blocks and wait for desktop to load MsgBox(0, @ScriptName, 'Wait for the desktop to finish loading and then click OK') EndIfCompile the script. Run the compiled script and then reboot the PC to see the result. Thanks for that explanation, had a decent Google for an answer but you have nailed for me. Cheers MC
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now