AutoHotkey Community

It is currently May 27th, 2012, 11:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: March 25th, 2006, 7:16 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 25th, 2006, 9:55 pm 
Offline

Joined: April 5th, 2005, 10:50 pm
Posts: 133
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
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 26th, 2006, 12:52 am 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2006, 4:00 am 
Offline

Joined: June 24th, 2004, 1:00 am
Posts: 114
Location: Malta
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 26th, 2006, 8:01 am 
Offline

Joined: April 5th, 2005, 10:50 pm
Posts: 133
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
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 27th, 2006, 12:23 am 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2006, 9:07 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2006, 12:22 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
sorry was refuring to the win.ini writing one and the reg writing one will see what your suggestion does...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2006, 12:50 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Last edited by SKAN on March 27th, 2006, 9:47 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: almost there
PostPosted: March 27th, 2006, 12:58 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2006, 1:11 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject: thanks!
PostPosted: March 27th, 2006, 8:04 pm 
Offline

Joined: January 31st, 2006, 1:27 pm
Posts: 197
Location: truro, cornwall
goyyah u are absulutly right once again!!!

fully up an running now cheer for that matey :)

Ralph.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 27th, 2006, 10:09 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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. :D

Regards, :)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group