bastian33

Autorun on boot

5 posts in this topic

#1 ·  Posted

Hi all,

 

Newbie here:)

I'd like to ask for a little help. 

I was playing a bit with autoit, trying to create a very simple script that opens webpages. So far so good, but when I tried to have it run on pc boo or Win start, it doesn't.

I've tried with adding it to startup folder, as well as registry, but for some reason, it doesn't autorun.

Help, pls?

#include <IE.au3>

RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'AutoClick3', "REG_SZ", @StartupDir & "\AutoClick3.exe")

; or shortcut instead of RegWrite: FileCreateShortcut(@ScriptFullPath, @StartupDir &"\Script.lnk")
If Not IsAdmin() Then ShellExecute(@ScriptFullPath, "", "", "runas")
ShellExecute ("http://www.google.com")
Sleep(3000)
ShellExecute ("http://www.google.com")

 

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted

Don't you mean @ScriptDir not @StartupDir unless of course you're copying the exe to the Startup folder?

Share this post


Link to post
Share on other sites

I'm copying it into the Startup folder, thanks.

Share this post


Link to post
Share on other sites

I suppose it all depends on who you're logging in as, the original user or a different user?  if you want all users to run this then it should be in the @StartupCommonDir, however whats confusing to me is that, your registry entry points to Startup folder which means that the program would have to run twice.  Once via Registry Run and the other via Startup folder.  You may also want to try using HKLM for 32-bit entries rather than HKEY_LOCAL_MACHINE and HKLM64 for 64-bit entries.

Share this post


Link to post
Share on other sites

If you only have one user on the system, I've had success with:

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run","keyName","REG_SZ",@ScriptFullPath)

You could probably replace HKCU with HKLM if you have multiple users, though I forget if it works correctly.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

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