script filename and autorun
Simon Dahlbacka
sdahlbacSPAMSUX at abo.fi
Tue Mar 18 09:50:09 EST 2003
More information about the Python-list mailing list
Tue Mar 18 09:50:09 EST 2003
- Previous message (by thread): script filename and autorun
- Next message (by thread): script filename and autorun
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Peter Hansen" <peter at engcorp.com> wrote in message news:3E77306D.5501D6A6 at engcorp.com... > Simon Dahlbacka wrote: > > > > I was thinking that I wanted to "autostart" my python program at bootup, I'm > > using windows and planned to use the registry through the win32api > > functions. > > > > 1) how do I get the filename of the current script running? (I want to > > detect location at runtime) > > import sys > currentScript = sys.argv[0] hmm.. why didn't I think of that?, the solution is so obvious when you see it.. :) > > > 2) is it enough with just a key "python > > c:\whateverthepathistomyprogram\prog.py" in ...\Run or do I also need full > > path to python? > > Why not try it? Normally a file association is set up so that "executing" > a .py file will automatically invoke Python, but it's conceivable this > doesn't work for items in "Run". It's really rather easy to try this > though. I'll do.. > The real question, though, is why don't you just drag a shortcut to your > .py file to the Startup folder? That way you are guaranteed that the > usual file associations will work, and it's much easier than munging > around in the registry. I was thinking that I would allow the user to set from within the program if it should be autostarted or not, but then again, it could also be done by creating deleting a shortcut in the Startup folder.. I'll have a look.. /Simon
- Previous message (by thread): script filename and autorun
- Next message (by thread): script filename and autorun
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list