sikuli中的日期函数

时间:2015-06-17 14:13:29

标签: java sikuli sikuli-ide

我需要在sikuli脚本中获取当前日期。 我在我的脚本中使用下面的代码片段,其中DATE已被硬编码,并且需要每天更改以每天运行脚本。 我试图在文档中找到,但在那里找不到。 CODE SNIPPET:

<!DOCTYPE html>
<html>
<head>
	
	
	
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
	<script src="./tree.jquery.js"></script>
	<link rel="stylesheet" href="./jqtree.css">
	<script src="./jquery-cookie/src/jquery.cookie.js"></script>
  
	

	<style>
		body{overflow-x:hidden}
		#navdata{width:auto; height:auto; flex:1; padding-bottom:1px;}
		#navgrid{width:50%; height:200px; overflow-x:hidden; overflow-y:scroll; border:solid 1px #79B7E7; background-color:white;}
        	#header{background-color: #79B7E7; width:100%; text-align: center;border: 1px solid white;}
      		.jqtree-element{background-color:#DDEBF7;border: 1px solid white;height:23px;color:red;}
      		.jqtree-tree .jqtree-title {color: black;}         
     		ul.jqtree-tree ul.jqtree_common {margin-left: 0px;}
      		ul.jqtree-tree .jqtree-toggler {color: #325D8A;}
      		ul.jqtree-tree .jqtree-toggler:hover {color: #3966df;text-decoration: none;}
      		.jqtree-tree .jqtree-title.jqtree-title-folder {margin-left: 0;}
      		span.jqtree-dragging {background: #79B7E7;}
      		ul.jqtree-tree li.jqtree-selected > .jqtree-element,ul.jqtree-tree li.jqtree-selected > .jqtree-element:hover {background: -webkit-gradient(linear, left top, left bottom, from(#BEE0F5), to(#79B7E7));}
   	</style>

	
</head>
<body>
	<div id="navgrid">
      <div id="header">Header</div>
		<div id="tree1"></div>
	</div>  
</body>


	<script type="text/javascript">
	 var ExampleData = {}; 
	 	 ExampleData.data = [
	    {
	        label: 'node1', id: 1,
	        children: [
	            { label: 'child1', id: 2 },
	            { label: 'child2', id: 3 }
	        ]
	    },
	    {
	        label: 'node2', id: 4,
	        children: [
	            { label: 'child3', id: 5 }
	        ]
	    }
	];
	
	ExampleData.getFirstLevelData = function(nodes) {
    if (! nodes) {
        nodes = ExampleData.example_data;
    }

    var data = [];

    $.each(nodes, function() {
        var node = {
            label: this.label,
            id: this.id
        };

        if (this.children) {
            node.load_on_demand = true;
        }

        data.push(node);
    });

    return data;
}

ExampleData.getChildrenOfNode = function(node_id) {
    var result = null;

    function iterate(nodes) {
        $.each(nodes, function() {
            if (result) {
                return;
            }
            else {
                if (this.id == node_id) {
                    result = this;
                }

                if (this.children) {
                    iterate(this.children);
                }
            }
        });
    }

    iterate(ExampleData.example_data);

    return ExampleData.getFirstLevelData(result.children);
}
	
	$('#tree1').tree({
	    data: ExampleData.data,
	    autoOpen: false,
	    dragAndDrop: true
	    
	});
    
	</script>

</html>

1 个答案:

答案 0 :(得分:1)

看看Pythons timedatetime与Sikuli不相符 例如:

import time

now = time.strftime('%c')

# Date 
print ('Date: ' + time.strftime('%x'))
# Time 
print('Current time: ' + time.strftime('%X'))
#Current date and time.
print ('Current time %s' % now )

"06-17-2015"更改time.strftime('%m-%d-%y')