def loadPropertyFromTextFile(filename, targetproperty, targetwindow):
    try:
        with open(xbmclibrary.translatePath(filename)) as file:
            value = file.read()
        xbmclibrary.setItemToProperty(targetproperty, value, targetwindow)
    except IOError:
        xbmclibrary.writeErrorMessage(FUNCTIONNAME, FUNCTIONNAME + ' terminates: Error while reading file ' + filename)
def execute(arguments):
    if len(sys.argv) > 4:
        minimumvalue = sys.argv[2]
        maximumvalue = sys.argv[3]
        targetproperty = sys.argv[4]
        targetwindow = baselibrary.extractArgument(arguments, 5, DEFAULTTARGETWINDOW)
        
        randomvalue = randint(minimumvalue, maximumvalue)
        xbmclibrary.setItemToProperty(targetproperty, randomvalue, targetwindow)
    else:
        xbmclibrary.writeErrorMessage(FUNCTIONNAME, FUNCTIONNAME + ' terminates: Missing argument(s) in call to script.')	
def copyProperties(sourcemask, targetmask, targetwindow):
    nameMethod = determineNameMethod(sourcemask)
    subtitleMethod = determineSubtitleMethod(sourcemask)
    thumbnailMethod = determineThumbnailMethod(sourcemask)
    backgroundImageMethod = determineBackgroundImageMethod(sourcemask)
    actionMethod = determineActionMethod(sourcemask)

    for index in range (1, TOTALITEMS + 1):
        sourcebase = sourcemask % (index)
        targetbase = targetmask % (index)

        xbmclibrary.setItemToProperty(targetbase + '.Name', nameMethod(sourcebase), targetwindow)
        xbmclibrary.setItemToProperty(targetbase + '.Subtitle', subtitleMethod(sourcebase), targetwindow)
        xbmclibrary.setItemToProperty(targetbase + '.Thumbnail', thumbnailMethod(sourcebase), targetwindow)
        xbmclibrary.setItemToProperty(targetbase + '.BackgroundImage', backgroundImageMethod(sourcebase), targetwindow)
        xbmclibrary.setItemToProperty(targetbase + '.Action', actionMethod(sourcebase), targetwindow)