Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel

On 04/09/2013 04:20 AM, daedae11 wrote:

On Windows, how to make a python script run on startup?




Windows has a system scheduler, which you can add entries to, specifying 
what time(s) a particular entry is to run.  One of the choices is system 
startup.



--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Alexander Mark
There is a startup folder, usually on the start menu, you can add the script 
to. 

--ame

On Apr 9, 2013, at 4:20, daedae11 daeda...@126.com wrote:

 On Windows, how to make a python script run on startup?
 
 
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Sayan Chatterjee
Anything executable inside the start-up folder will run on start up!


On 9 April 2013 15:24, Alexander Mark rhettna...@gmail.com wrote:

 There is a startup folder, usually on the start menu, you can add the
 script to.

 --ame

 On Apr 9, 2013, at 4:20, daedae11 daeda...@126.com wrote:

 On Windows, how to make a python script run on startup?


 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread eryksun
On Tue, Apr 9, 2013 at 5:54 AM, Alexander Mark rhettna...@gmail.com wrote:
 There is a startup folder, usually on the start menu, you can add the script
 to.

current user:
%USERPROFILE%\Start Menu\Programs\Startup

all users:
%ALLUSERSPROFILE%\Start Menu\Programs\Startup

Updating the latter will probably require elevation, which you do via
ShellExecute with the runas verb, using either pywin32 or ctypes. If
you don't want a console use the .pyw extension.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Kevin Ndung'u
anybody know how to do this on linux?

On 4/9/13, eryksun eryk...@gmail.com wrote:
 On Tue, Apr 9, 2013 at 5:54 AM, Alexander Mark rhettna...@gmail.com
 wrote:
 There is a startup folder, usually on the start menu, you can add the
 script
 to.

 current user:
 %USERPROFILE%\Start Menu\Programs\Startup

 all users:
 %ALLUSERSPROFILE%\Start Menu\Programs\Startup

 Updating the latter will probably require elevation, which you do via
 ShellExecute with the runas verb, using either pywin32 or ctypes. If
 you don't want a console use the .pyw extension.
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Sayan Chatterjee
Hope this link helps.:)
http://stackoverflow.com/questions/8339555/how-to-run-a-script-at-the-start-up-of-ubuntu


On 9 April 2013 19:18, Kevin Ndung'u kevgath...@gmail.com wrote:

 anybody know how to do this on linux?

 On 4/9/13, eryksun eryk...@gmail.com wrote:
  On Tue, Apr 9, 2013 at 5:54 AM, Alexander Mark rhettna...@gmail.com
  wrote:
  There is a startup folder, usually on the start menu, you can add the
  script
  to.
 
  current user:
  %USERPROFILE%\Start Menu\Programs\Startup
 
  all users:
  %ALLUSERSPROFILE%\Start Menu\Programs\Startup
 
  Updating the latter will probably require elevation, which you do via
  ShellExecute with the runas verb, using either pywin32 or ctypes. If
  you don't want a console use the .pyw extension.
  ___
  Tutor maillist  -  Tutor@python.org
  To unsubscribe or change subscription options:
  http://mail.python.org/mailman/listinfo/tutor
 
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor




-- 


--
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread eryksun
On Tue, Apr 9, 2013 at 8:35 AM, daedae11 daeda...@126.com wrote:
 I refer the msdn for ShellExecute, there isn't a runas verb, only edit,
 find, open, print, properties.

Adding a file to the all users startup folder probably doesn't even
require elevation. Maybe even a regular user can do it, given the
default ProgramData NTFS permissions. I don't remember what the
defaults are.

Background:

NT 6 (Vista) added User Account Control (UAC), which adds the run as
administrator option. This launches a process with an elevated access
token.

ShellExecute allows the same with the runas verb. You can verify
whether it exists on your system for the exefile filetype (e.g.
python.exe):

C:\reg query hkcr\exefile\shell\runas\command

HKEY_CLASSES_ROOT\exefile\shell\runas\command
(Default)REG_SZ%1 %*
IsolatedCommandREG_SZ%1 %*

On a related note, the old runas.exe console command lets you launch
a process with the credentials of an administrator account. However,
it can't 'elevate' the process.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread eryksun
On Tue, Apr 9, 2013 at 9:48 AM, Kevin Ndung'u kevgath...@gmail.com wrote:

 anybody know how to do this on linux?

For a desktop environment that implements freedesktop.org standards (X
Desktop Group), such as GNOME, KDE and Xfce, you can add .desktop
files per user to $HOME/.config/autostart. System wide it's
$XDG_CONFIG_DIRS/autostart.

http://standards.freedesktop.org/autostart-spec/latest/ar01s02.html
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel

On 04/09/2013 05:54 AM, Alexander Mark wrote:

On Apr 9, 2013, at 4:20, daedae11 daeda...@126.com wrote:


On Windows, how to make a python script run on startup?


_

(Top-posted comment moved AFTER the question)

 There is a startup folder, usually on the start menu, you can add the 
script to.



But does anything in the startup folder run BEFORE any user logs in? 
It's been a long time since I had to run Windows, but I didn't think so.



--
DaveA
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel

On 04/09/2013 06:58 AM, daedae11 wrote:

(Please don't top-post.  And don't forget to include the list in your 
cc.  I'm forwarding it for you)



Which module to should I use to add entries to that system scheduler?




The system scheduler is an interactive (gui) program that comes with the 
OS.  No idea what module would mean in this context.   And I haven't run 
Windows in a long time, except for occasionally helping others.


Every version of Windows does its best to move things around and confuse 
any administrative user.


For XP, try:
  http://support.microsoft.com/kb/308569

and notice there's a distinction between When my computer starts and 
When a user logs on


--
DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread eryksun
On Tue, Apr 9, 2013 at 12:35 PM, Dave Angel da...@davea.name wrote:
 But does anything in the startup folder run BEFORE any user logs in? It's
 been a long time since I had to run Windows, but I didn't think so.

The contents of the startup folders are executed in the current
session after logon. The same applies to run keys such as
HKLM\Software\Microsoft\Windows\CurrentVersion\Run.

I wasn't taking startup to mean literally before any user has logged
on. But yes, if that's the requirement, you can use the Task Scheduler
service to start a program as a batch process in session 0 (or instead
create your own service).

Just as an FYI, in the Home versions of Windows the task scheduler
can't store logon credentials, so to run at startup you have to use
LOCALSERVICE or SYSTEM.

To automate creating a task use the schtasks command. For example,
to create a task named Python that runs python.exe at startup under
the LOCALSERVICE account, execute the following from an elevated
shell:

schtasks /Create /TN Python /RU LOCALSERVICE /SC ONSTART /TR
C:\Python33\python.exe

This will run as a non-interactive service in session 0. There won't
be a visible GUI or console window to interact with in your desktop
session.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Alan Gauld

On 09/04/13 09:20, daedae11 wrote:

On Windows, how to make a python script run on startup?


The same way you make anything run on startup there is nothing magical 
about Python code.


You can schedule it, add it to the registry or put it in the users 
startup folder if you want it at login rather than system start...


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor