1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # imports import sys from System.Diagnostics import Process from System.Diagnostics import Debugger from System.IO import Path from System.Net import WebClient #Debugger.Break() # # This is a cforge command (script file) # this will be run as ironpython script. # the filename of this script is automatically the corresponding cforge command # with some magic functions you can easily integrate it nicely into cforge tool # cforge_usage: # here you can return an array of all possible arguments and options that can # be passed to this command script def cforge_usage(): help = [ ["<url_to_package>", "download and install a codesys package"], ["<local path of package>", "install a local codesys package"] ] return help print("command install running") print("Arguments: " + str(len(sys.argv))) for a in sys.argv: print(a) # download localpath = Path.GetFilename(sys.argv[0]) url = sys.argv[0] web_client = WebClient() web_client.DownloadFile(url, localpath) # and install local package now: Process.Start(localpath) |