Hi
Need help with my python functions
Where or How can I put def get_startupapps_path(): function in def install(): ?
so that when program copy it self to windows homdir,it will be start my ipScript every time at windows startup.Becuse my machine has dynamisk IP-adress.
import sys
import os
import getpass
import platform
import shutil
HOME = os.path.join(os.environ['HOMEDRIVE'], os.environ['HOMEPATH'])
def get_startupapps_path():
user = getpass.getuser()
if platform.release() == '7':
return 'C:\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ ' % user
elif platform.release().lower() == 'xp':
return 'C:\Documents and Settings\%s\Start Menu\Programs\Startup\ ' % user
def install():
path = sys.argv[0] # get path to script
head, tail = os.path.split(path) # return dir and file name
shutil.copy(path, HOME) # copy executable to %LOCALAPPDATA%
executable = os.path.join(HOME, tail)
head, tail = os.path.split(sys.argv[0])
if HOME != head:
install()
#get_startupapps_path()