def Var_StringToHexString(uVarName): """ Converts a var value to a hex string. The changed variable value will be returned and stored in the destination var (Triggers raised if set) :rtype: string :param string uVarName: The variable name for the action, from where the value is pulled :return: The changed variable value """ uValue = GetVar(uVarName=uVarName) uValue = uValue.encode("hex") SetVar(uVarName=uVarName, oVarValue=uValue) return uValue
def Var_StringToHexString(uVarName: str) -> str: """ Converts a var value to a hex string. The changed variable value will be returned and stored in the destination var (Triggers raised if set) eg: "paul" to "7061756c" :param str uVarName: The variable name for the action, from where the value is pulled :return: The changed variable value """ uValue = GetVar(uVarName=uVarName) try: uValue = ToUnicode(uValue.encode("utf-8").hex()) SetVar(uVarName=uVarName, oVarValue=uValue) return uValue except Exception as e: LogError(uMsg=u'Var_StringToHexString: Invalid Argument [' + uVarName + u'=' + uValue + u']:', oException=e) return u'Error'