| View previous topic :: View next topic |
| Author |
Message |
ralphh85
Joined: 31 Jan 2006 Posts: 194 Location: truro, cornwall
|
Posted: Sat Mar 25, 2006 7:16 pm Post subject: running programs on start up |
|
|
is there a way to run programs on pc start up idealy with out copying a shortcut in the start up folder?
if not does anyone know the quick rout to the start up folder so a shortcut can automatically be copyed?
thanks Ralph. |
|
| Back to top |
|
 |
MYYM
Joined: 05 Apr 2005 Posts: 132
|
Posted: Sat Mar 25, 2006 9:55 pm Post subject: Re: running programs on start up |
|
|
| ralphh85 wrote: | | does anyone know the quick rout to the start up folder so a shortcut can automatically be copyed? |
from AHK help documents
| Quote: | | A_Startup The full path and name of the Startup folder in the current user's Start Menu |
check out the whole list of Built-in variables _________________ MYYM
 |
|
| Back to top |
|
 |
Serenity
Joined: 08 Nov 2004 Posts: 894
|
Posted: Sun Mar 26, 2006 12:52 am Post subject: Re: running programs on start up |
|
|
| ralphh85 wrote: | | is there a way to run programs on pc start up idealy with out copying a shortcut in the start up folder? |
You could use the registry, eg:
| Code: | title = myscript
; write
regwrite, REG_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Run, %title%, %A_ScriptFullPath%
; delete
regdelete, HKCU, Software\Microsoft\Windows\CurrentVersion\Run, %title% |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
bahri
Joined: 24 Jun 2004 Posts: 101 Location: Malta
|
Posted: Sun Mar 26, 2006 4:00 am Post subject: |
|
|
Hi!
Prepare your script/Program (whatevever you want to run)
Start Group policy --- at the run command (Start - Run) type gpedit.msc
Open User Configuration then window settings.
Then Scripts (Logon/Logoff)
Click on Logon Click Properties
Add whatever you want to run here (can also take parameters)
Can be used for users or system both logOn and Off
This method is great for running things at Logoff which is not so obvious otherwise in windows
Hope this helps
bahri |
|
| Back to top |
|
 |
MYYM
Joined: 05 Apr 2005 Posts: 132
|
Posted: Sun Mar 26, 2006 8:01 am Post subject: Re: running programs on start up |
|
|
| ralphh85 wrote: | | is there a way to run programs on pc start up idealy with out copying a shortcut in the start up folder? |
You can use IniWrite to add line to windows section in win.ini file
| Code: | | IniWrite, "c:\myfolder\mysubfolder\myprogram.exe", %windir%\win.ini, Windows, Run |
_________________ MYYM
 |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 194 Location: truro, cornwall
|
Posted: Mon Mar 27, 2006 12:23 am Post subject: works ok if there are no spaces in the location... |
|
|
this works if i put my script in c:\ but if its in anywhere like desktop it does not work an i believe this is because there are spaces in "documants and settings" etc ??
anyone know any solutions to this?
thanks Ralph |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5816
|
Posted: Mon Mar 27, 2006 9:07 am Post subject: |
|
|
Dear ralphh85,
| You wrote: | this works if i put my script in c:\ but if its in anywhere like desktop it does not work an i believe this is because there are spaces in "documants and settings" etc ??
anyone know any solutions to this? |
What works? Whose post are you referring to? All of them have given ideal solutions!
If you're bugged by the spaces in the filepath try converting it to ShortPath with A_LoopFileShortPath.
For example:
| Code: | File = %A_ProgramFiles%\Windows Media Player\Wmplayer.exe
FileShortPath := ShortpathFileName(File)
Msgbox, % FileShortPath
return
ShortPathFileName(Path)
{
Loop, % Path
Return %A_LoopFileShortPath%
} |
Thank you. Regards,  _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 194 Location: truro, cornwall
|
Posted: Mon Mar 27, 2006 12:22 pm Post subject: |
|
|
| sorry was refuring to the win.ini writing one and the reg writing one will see what your suggestion does... |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5816
|
Posted: Mon Mar 27, 2006 12:50 pm Post subject: |
|
|
Dear ralphh85,
| You wrote: | | sorry was refuring to the win.ini writing one and the reg writing one will see what your suggestion does... |
Oh! Including the following two lines in any script will write the script's ShortPath to Win.INI !
| Code: | Loop, % A_ScriptFullPath
IniWrite, % A_LoopFileShortPath, %windir%\win.ini, Windows, Run |
Regards,  _________________ SKAN - Suresh Kumar A N
Last edited by SKAN on Mon Mar 27, 2006 9:47 pm; edited 1 time in total |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 194 Location: truro, cornwall
|
Posted: Mon Mar 27, 2006 12:58 pm Post subject: almost there |
|
|
i prefure the reg write one but it works now done what u said how ever it fires my program up an it apears the program has not found its ini file? it comes up with all the defaults rather than the things its suposed to?
any ideas?
thanks, Ralph. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5816
|
Posted: Mon Mar 27, 2006 1:11 pm Post subject: |
|
|
Dear Ralph,
| You wrote: | i prefure the reg write one but it works now done what u said how ever it fires my program up an it apears the program has not found its ini file? it comes up with all the defaults rather than the things its suposed to?
any ideas? |
Include the following line in the beginning of your script
| Code: | | SetWorkingDir, %A_ScriptDir% |
See, SetWorkingDir for documentation.
If this is not what you referring to, please rephrase your question.
Thank you. Regards,  _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
ralphh85
Joined: 31 Jan 2006 Posts: 194 Location: truro, cornwall
|
Posted: Mon Mar 27, 2006 8:04 pm Post subject: thanks! |
|
|
goyyah u are absulutly right once again!!!
fully up an running now cheer for that matey
Ralph. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5816
|
Posted: Mon Mar 27, 2006 10:09 pm Post subject: Re: running programs on start up |
|
|
Dear Ralph,
I suggested the Shortpath because I thought you had opted IniWrite.
But for RegWrite solution you not need mess the Registry with a Shortpath.
Instead amend the following change and you're set.
| Serenity wrote: | title = myscript
; write
regwrite, REG_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Run, %title%, %A_ScriptFullPath% |
Put the variable %A_ScriptFullPath% in quotes as done in the following :-
| Quote: | | regwrite, REG_SZ, HKCU,Software\Microsoft\Windows\CurrentVersion\Run, %title%, "%A_ScriptFullPath%" |
I am happy that you have a working solution.
Regards,  _________________ SKAN - Suresh Kumar A N |
|
| Back to top |
|
 |
|