AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

running programs on start up

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ralphh85



Joined: 31 Jan 2006
Posts: 194
Location: truro, cornwall

PostPosted: Sat Mar 25, 2006 7:16 pm    Post subject: running programs on start up Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
MYYM



Joined: 05 Apr 2005
Posts: 132

PostPosted: Sat Mar 25, 2006 9:55 pm    Post subject: Re: running programs on start up Reply with quote

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
View user's profile Send private message Visit poster's website
Serenity



Joined: 08 Nov 2004
Posts: 894

PostPosted: Sun Mar 26, 2006 12:52 am    Post subject: Re: running programs on start up Reply with quote

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
View user's profile Send private message Visit poster's website
bahri



Joined: 24 Jun 2004
Posts: 101
Location: Malta

PostPosted: Sun Mar 26, 2006 4:00 am    Post subject: Reply with quote

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
View user's profile Send private message
MYYM



Joined: 05 Apr 2005
Posts: 132

PostPosted: Sun Mar 26, 2006 8:01 am    Post subject: Re: running programs on start up Reply with quote

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
View user's profile Send private message Visit poster's website
ralphh85



Joined: 31 Jan 2006
Posts: 194
Location: truro, cornwall

PostPosted: Mon Mar 27, 2006 12:23 am    Post subject: works ok if there are no spaces in the location... Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5816

PostPosted: Mon Mar 27, 2006 9:07 am    Post subject: Reply with quote

Dear ralphh85, Smile

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, Smile
_________________
SKAN - Suresh Kumar A N
Back to top
View user's profile Send private message
ralphh85



Joined: 31 Jan 2006
Posts: 194
Location: truro, cornwall

PostPosted: Mon Mar 27, 2006 12:22 pm    Post subject: Reply with quote

sorry was refuring to the win.ini writing one and the reg writing one will see what your suggestion does...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5816

PostPosted: Mon Mar 27, 2006 12:50 pm    Post subject: Reply with quote

Dear ralphh85, Smile

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, Smile
_________________
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
View user's profile Send private message
ralphh85



Joined: 31 Jan 2006
Posts: 194
Location: truro, cornwall

PostPosted: Mon Mar 27, 2006 12:58 pm    Post subject: almost there Reply with quote

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
View user's profile Send private message Send e-mail MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5816

PostPosted: Mon Mar 27, 2006 1:11 pm    Post subject: Reply with quote

Dear Ralph, Smile

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, Smile
_________________
SKAN - Suresh Kumar A N
Back to top
View user's profile Send private message
ralphh85



Joined: 31 Jan 2006
Posts: 194
Location: truro, cornwall

PostPosted: Mon Mar 27, 2006 8:04 pm    Post subject: thanks! Reply with quote

goyyah u are absulutly right once again!!!

fully up an running now cheer for that matey Smile

Ralph.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5816

PostPosted: Mon Mar 27, 2006 10:09 pm    Post subject: Re: running programs on start up Reply with quote

Dear Ralph, Smile

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. Very Happy

Regards, Smile
_________________
SKAN - Suresh Kumar A N
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group