-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
277 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ bin/misc | |
*.json | ||
*.bak | ||
*.class | ||
*.sikuli | ||
test.py | ||
*.tmp | ||
unins000.* | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
|
||
<html> | ||
<head> | ||
<style type="text/css"> | ||
.sikuli-code { | ||
font-size: 20px; | ||
font-family: "Osaka-mono", Monospace; | ||
line-height: 1.5em; | ||
display:table-cell; | ||
white-space: pre-wrap; /* css-3 */ | ||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ | ||
white-space: -pre-wrap; /* Opera 4-6 */ | ||
white-space: -o-pre-wrap; /* Opera 7 */ | ||
word-wrap: break-word; /* Internet Explorer 5.5+ */ | ||
width: 99%; /* remove horizontal scroll-bar when viewing in IE7 */ | ||
} | ||
.sikuli-code img { | ||
vertical-align: middle; | ||
margin: 2px; | ||
border: 1px solid #ccc; | ||
padding: 2px; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-moz-box-shadow: 1px 1px 1px gray; | ||
-webkit-box-shadow: 1px 1px 2px gray; | ||
} | ||
.kw { | ||
color: blue; | ||
} | ||
.skw { | ||
color: rgb(63, 127, 127); | ||
} | ||
|
||
.str { | ||
color: rgb(128, 0, 0); | ||
} | ||
|
||
.dig { | ||
color: rgb(128, 64, 0); | ||
} | ||
|
||
.cmt { | ||
color: rgb(200, 0, 200); | ||
} | ||
|
||
h2 { | ||
display: inline; | ||
font-weight: normal; | ||
} | ||
|
||
.info { | ||
border-bottom: 1px solid #ddd; | ||
padding-bottom: 5px; | ||
margin-bottom: 20px; | ||
display: none; | ||
} | ||
|
||
a { | ||
color: #9D2900; | ||
} | ||
|
||
body { | ||
font-family: "Trebuchet MS", Arial, Sans-Serif; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<div class="info"> | ||
<h2>example.sikuli\example.sikuli</h2> <a href="example.sikuli\example.zip">(Download this script)</a> | ||
</div> | ||
<pre class="sikuli-code"> | ||
<span class="kw">from</span> sikuli <span class="kw">import</span> * | ||
|
||
<span class="kw">def</span> export_command(): | ||
<span class="skw">click</span>(<img src="1434072940616.png" />) | ||
</pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from sikuli import * | ||
|
||
def export_command(): | ||
click("1434072940616.png") |
131 changes: 131 additions & 0 deletions
131
caster/asynch/sikuli/scripts/xmlrpc_server.sikuli/xmlrpc_server.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
|
||
<html> | ||
<head> | ||
<style type="text/css"> | ||
.sikuli-code { | ||
font-size: 20px; | ||
font-family: "Osaka-mono", Monospace; | ||
line-height: 1.5em; | ||
display:table-cell; | ||
white-space: pre-wrap; /* css-3 */ | ||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ | ||
white-space: -pre-wrap; /* Opera 4-6 */ | ||
white-space: -o-pre-wrap; /* Opera 7 */ | ||
word-wrap: break-word; /* Internet Explorer 5.5+ */ | ||
width: 99%; /* remove horizontal scroll-bar when viewing in IE7 */ | ||
} | ||
.sikuli-code img { | ||
vertical-align: middle; | ||
margin: 2px; | ||
border: 1px solid #ccc; | ||
padding: 2px; | ||
-moz-border-radius: 5px; | ||
-webkit-border-radius: 5px; | ||
-moz-box-shadow: 1px 1px 1px gray; | ||
-webkit-box-shadow: 1px 1px 2px gray; | ||
} | ||
.kw { | ||
color: blue; | ||
} | ||
.skw { | ||
color: rgb(63, 127, 127); | ||
} | ||
|
||
.str { | ||
color: rgb(128, 0, 0); | ||
} | ||
|
||
.dig { | ||
color: rgb(128, 64, 0); | ||
} | ||
|
||
.cmt { | ||
color: rgb(200, 0, 200); | ||
} | ||
|
||
h2 { | ||
display: inline; | ||
font-weight: normal; | ||
} | ||
|
||
.info { | ||
border-bottom: 1px solid #ddd; | ||
padding-bottom: 5px; | ||
margin-bottom: 20px; | ||
display: none; | ||
} | ||
|
||
a { | ||
color: #9D2900; | ||
} | ||
|
||
body { | ||
font-family: "Trebuchet MS", Arial, Sans-Serif; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<div class="info"> | ||
<h2>xmlrpc_server.sikuli\xmlrpc_server.sikuli</h2> <a href="xmlrpc_server.sikuli\xmlrpc_server.zip">(Download this script)</a> | ||
</div> | ||
<pre class="sikuli-code"> | ||
<span class="kw">import</span> SimpleXMLRPCServer | ||
<span class="kw">from</span> SimpleXMLRPCServer <span class="kw">import</span> * | ||
<span class="kw">import</span> sys | ||
<span class="kw">from</span> inspect <span class="kw">import</span> getmembers, isfunction | ||
|
||
SCRIPTS_PATH = sys.argv[<span class="dig">0</span>].split(<span class="str">"\\xmlrpc_server.sikuli"</span>)[<span class="dig">0</span>] | ||
BASE_PATH = sys.argv[<span class="dig">0</span>].split(<span class="str">"MacroSystem"</span>)[<span class="dig">0</span>] + <span class="str">"MacroSystem"</span> | ||
|
||
modules = [] | ||
server = SimpleXMLRPCServer((<span class="str">"127.0.0.1"</span>, <span class="dig">8000</span>), allow_none=True) | ||
quit = <span class="dig">0</span> | ||
|
||
<span class="kw">def</span> ping(): | ||
<span class="kw">return</span> <span class="dig">1</span> | ||
<span class="kw">def</span> list_functions(): | ||
<span class="kw">global</span> modules | ||
<span class="kw">return</span> modules | ||
<span class="kw">def</span> terminate(): | ||
<span class="kw">global</span> quit | ||
quit = <span class="dig">1</span> | ||
<span class="kw">return</span> <span class="dig">1</span> | ||
|
||
server.register_function(list_functions, <span class="str">"list_functions"</span>) | ||
server.register_function(terminate, <span class="str">"terminate"</span>) | ||
|
||
<span class="kw">if</span> SCRIPTS_PATH <span class="kw">not</span> <span class="kw">in</span> sys.path: | ||
sys.path.append(SCRIPTS_PATH) | ||
<span class="kw">for</span> s <span class="kw">in</span> [x[<span class="dig">0</span>] <span class="kw">for</span> x <span class="kw">in</span> os.walk(SCRIPTS_PATH)]: | ||
<span class="kw">if</span> s.endswith(<span class="str">".sikuli"</span>) <span class="kw">and</span> <span class="kw">not</span> s.endswith(<span class="str">"xmlrpc_server.sikuli"</span>): | ||
mdl_name = s.split(<span class="str">"."</span>)[<span class="dig">0</span>].split(<span class="str">"\\"</span>)[-<span class="dig">1</span>] | ||
<span class="kw">exec</span>(<span class="str">"import "</span> + mdl_name) | ||
<span class="kw">exec</span>(<span class="str">"l = getmembers("</span> + mdl_name+<span class="str">", isfunction)"</span>) | ||
<span class="kw">for</span> d <span class="kw">in</span> l: | ||
<span class="kw">if</span> d[<span class="dig">0</span>].startswith(<span class="str">"export_"</span>): | ||
registered_function_name=mdl_name+<span class="str">"_"</span>+d[<span class="dig">0</span>].replace(<span class="str">"export_"</span>, <span class="str">""</span>) | ||
modules.append(registered_function_name) | ||
<span class="kw">exec</span>(<span class="str">"server.register_function("</span>+mdl_name+<span class="str">"."</span>+d[<span class="dig">0</span>]+<span class="str">", '"</span>+registered_function_name+<span class="str">"')"</span>) | ||
|
||
|
||
<span class="kw">print</span> <span class="str">"Caster Sikuli Bridge\n\nlist of available commands "</span> + str(modules) | ||
|
||
|
||
|
||
<span class="cmt"># examples | ||
</span><span class="kw">def</span> add(self, x, y): | ||
<span class="kw">return</span> x + y | ||
|
||
|
||
|
||
|
||
<span class="kw">try</span>: | ||
<span class="kw">while</span> <span class="kw">not</span> quit: | ||
server.handle_request() | ||
<span class="cmt"># server.serve_forever() | ||
</span><span class="kw">except</span> KeyboardInterrupt: | ||
<span class="kw">print</span> <span class="str">'Exiting'</span> | ||
</pre> | ||
</body> | ||
</html> |
55 changes: 55 additions & 0 deletions
55
caster/asynch/sikuli/scripts/xmlrpc_server.sikuli/xmlrpc_server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import SimpleXMLRPCServer | ||
from SimpleXMLRPCServer import * | ||
import sys | ||
from inspect import getmembers, isfunction | ||
|
||
SCRIPTS_PATH = sys.argv[0].split("\\xmlrpc_server.sikuli")[0] | ||
BASE_PATH = sys.argv[0].split("MacroSystem")[0] + "MacroSystem" | ||
|
||
modules = [] | ||
server = SimpleXMLRPCServer(("127.0.0.1", 8000), allow_none=True) | ||
quit = 0 | ||
|
||
def ping(): | ||
return 1 | ||
def list_functions(): | ||
global modules | ||
return modules | ||
def terminate(): | ||
global quit | ||
quit = 1 | ||
return 1 | ||
|
||
server.register_function(list_functions, "list_functions") | ||
server.register_function(terminate, "terminate") | ||
|
||
if SCRIPTS_PATH not in sys.path: | ||
sys.path.append(SCRIPTS_PATH) | ||
for s in [x[0] for x in os.walk(SCRIPTS_PATH)]: | ||
if s.endswith(".sikuli") and not s.endswith("xmlrpc_server.sikuli"): | ||
mdl_name = s.split(".")[0].split("\\")[-1] | ||
exec("import " + mdl_name) | ||
exec("l = getmembers(" + mdl_name+", isfunction)") | ||
for d in l: | ||
if d[0].startswith("export_"): | ||
registered_function_name=mdl_name+"_"+d[0].replace("export_", "") | ||
modules.append(registered_function_name) | ||
exec("server.register_function("+mdl_name+"."+d[0]+", '"+registered_function_name+"')") | ||
|
||
|
||
print "Caster Sikuli Bridge\n\nlist of available commands " + str(modules) | ||
|
||
|
||
|
||
# examples | ||
def add(self, x, y): | ||
return x + y | ||
|
||
|
||
|
||
|
||
try: | ||
while not quit: | ||
server.handle_request() | ||
except KeyboardInterrupt: | ||
print 'Exiting' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters