How to start app at Windows startup?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to start app at Windows startup?
Hi
Is it possible to create app shortcut in Startup folder under Windows Start menu? I want to start my app everytime Windows start.
Thanks
Is it possible to create app shortcut in Startup folder under Windows Start menu? I want to start my app everytime Windows start.
Thanks
-
- Posts: 111
- Joined: Sun Aug 23, 2009 7:48 am
- Contact:
Re: How to start app at Windows startup?
I'm not a Windows user but I can't see any reason why it should not work as Revolution apps are "ordinary" Windows apps, but then it starts at "login" and not at windows start-up. I guess there must be a registry setting you can use to auto-start your app also.Srdjan wrote:Hi
Is it possible to create app shortcut in Startup folder under Windows Start menu? I want to start my app everytime Windows start.
Thanks
Hi Srdjan,
check this page for "specialfolderpath()" codes on Windows
http://www.sonsothunder.com/devres/revo ... ile010.htm
and then check "create alias" in the Rev documentation
"alias" = Shortcut!
Best
Klaus
check this page for "specialfolderpath()" codes on Windows
http://www.sonsothunder.com/devres/revo ... ile010.htm
and then check "create alias" in the Rev documentation

"alias" = Shortcut!
Best
Klaus
http://www.sonsothunder.com/devres/revo ... ile010.htm is the bible for specialFolderPath codes.
If you put a shortcut to your program into specialFolderPath(7) then the application should run on startup of the correctly logged in user. To start up when any of the users of that machine logs in then you can use specialFolderPath(24).
To create the shortcut link you can use some vbscript:If you replace the sLinkFile path with the value returned from specialFolderPath(7) then that will create your shortcut in the current user's startup path. You can place the link in other locations, by replacing that path with the value returned from another specialFolderPath, such as (16) for the user's desktop, or (23) for all users' desktops. Having replaced the correct values in the script, you can get RunRev to and check the result to see what errors there may be - in theory, none, and you should find the shortcuts created in the correct location.
If you want the application to start without anyone having to log on, then you would need to install it as a service and/or mess with the registry.
HTH
SparkOut
If you put a shortcut to your program into specialFolderPath(7) then the application should run on startup of the correctly logged in user. To start up when any of the users of that machine logs in then you can use specialFolderPath(24).
To create the shortcut link you can use some vbscript:
Code: Select all
On Error Resume Next
result = "OK"
Set oWS = CreateObject("WScript.Shell")
If Err <> 0 then
result = "Error creating shell"
End If
If result = "OK" then
sLinkFile = "<path for the destination of the shortcut>.lnk"
Set oLink = oWS.CreateShortcut(sLinkFile)
If Err <> 0 then
result = "Error creating shortcut link file"
End If
End If
If result = "OK" then
oLink.TargetPath = "<path to your application>.exe"
oLink.Description = "<uh... a description>"
oLink.IconLocation = "<path to your icon file, which naturally will be the same as your application that has the embedded icon>.exe,0"
'the trailing 0 is the index number of the icon to use inside the icon file. I confess I
'don't know what the difference is when there's only one icon for your application.
'I have used index 0 or 1 interchangeably, while my applications contain 16 versions
'of the same icon at different sizes and bit depths. Windows seems to display the right
'resolution version of it whatever. At least for me, in my present experience.
oLink.WindowStyle = 1
oLink.Save
If Err <> 0 then
result = "Error creating shortcut icon"
End If
End If
Set oWS = nothing
Code: Select all
do <thescript> as "vbscript"
If you want the application to start without anyone having to log on, then you would need to install it as a service and/or mess with the registry.
HTH
SparkOut
Or of course (duh!) get RunRev to do the complicated stuff!
I must admit, I'd not got that to work properly with the icons before, but I just tested and it's fine. Will save me bothering in future!
Thanks Klausimausi!
Code: Select all
put the defaultFolder into theFolder
set the defaultFolder to specialFolderPath(7)
create alias "MyShortcut.lnk" to file <path to my file>
'make sure you include the .lnk extension to the name on Windows
set the defaultFolder to theFolder
Thanks Klausimausi!
-
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
- Contact:
Hi srdjan,
You might wanna try making it run via the registry. IMHO, its a more professional way of doing it... A quick code I can think of right about now is like below:
Don't worry about messing up your registry, because you only need to change My_App to your own liking then just put the path of your program into the variable thePathToYourProgram or just use your own. You don't need to mess with the other parts of the code.. ^^
You might wanna try making it run via the registry. IMHO, its a more professional way of doing it... A quick code I can think of right about now is like below:
Code: Select all
get setRegistry("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\My_App",thePathToYourProgram)
Not wishing to suggest there's anything wrong with your approach, but IMHO I don't think it can be claimed to be more professional. If anything, I would err on the side that it's more of a "quick and dirty" way, that is effective, but is rather reminiscent of "hacker techniques" and as such, could easily flag up as malware on the client system (as could any, of course, but I hope you see why I'm slightly dubious about starting something from the registry without going through a proper installation procedure).shadowslash wrote:You might wanna try making it run via the registry. IMHO, its a more professional way of doing it...
Re: How to start app at Windows startup?
Additionally, depending on the security environment the OP is deploying to, changes to the registry may very likely be locked out. However, it is usually less likely for the Startup folder to be locked down. At least, that has been my personal experience having worked in a pretty strict environment (Centers for Disease Control and Prevention).
Take care.
Take care.
- John