Permalink
Browse files

checking in python version of the code

  • Loading branch information...
penguinho committed Aug 31, 2012
1 parent 3ab56d3 commit 9b891207be0957bf209a77242750da17d3eb8eda
View
@@ -2,3 +2,11 @@
main/Utility/Properties/Resources.resources
main/Testing/Properties/.DS_Store
python/.DS_Store
python/.svn/all-wcprops
python/.svn/entries
*.svn-base
Binary file not shown.
@@ -0,0 +1,15 @@
repeat
set procs to ""
tell application "System Events"
set procs to name of every process
end tell
if procs contains "SecurityAgent" then
tell application "System Events"
tell process "SecurityAgent" to set value of text field 1 of scroll area 1 of group 1 of window 1 to "$USERNAME"
tell process "SecurityAgent" to set value of text field 2 of scroll area 1 of group 1 of window 1 to "$PASSWORD"
click button 2 of group 2 of window 1 of application process "SecurityAgent"
log ("Dismissed Security Dialog")
end tell
end if
delay 1
end repeat
View
@@ -0,0 +1,86 @@
/* ***** helper functions ***** */
// delay in seconds
function delay(secs)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < (secs * 1000.0));
}
// find cell with name
function findCellWithName(cellName, window) {
return window.visibleCells()[cellName];
for (index = 0; index < window.tableViews().length; index = index + 1) {
cell = window.tableViews()[index].visibleCells()[cellName];
if ((cell != null) && (cell.toString() != "[object UIAElementNil]")) {
return cell;
}
}
return UIAElementNil;
}
/* ***** main loop ***** */
// automation globals
var iosAutoPath = "$PATH_ROOT"
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var host = target.host();
var mainWindow = application.mainWindow();
// loop variables
var runLoop = true;
var instructionNumber = 0;
// main loop
while (runLoop)
{
var instructionFile = iosAutoPath + instructionNumber.toString() + "-cmd.txt";
var responseFile = iosAutoPath + instructionNumber.toString() + "-resp.txt";
var instruction = host.performTaskWithPathArgumentsTimeout("/bin/cat", [instructionFile], 5);
if (instruction.exitCode == 0)
{
var resp = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<collection>\n";
var instructionText = instruction.stdout;
try
{
var jsCommands = instructionText.split('\n');
for (var jsCommandIndex = 0; jsCommandIndex < jsCommands.length; jsCommandIndex++)
{
var jsCommand = jsCommands[jsCommandIndex];
try
{
UIALogger.logDebug(instructionNumber.toString() + "." + jsCommandIndex.toString() + " - Command - " + jsCommand);
var evalResult = eval(jsCommand);
if (evalResult == null)
{
evalResult = "";
}
UIALogger.logDebug(instructionNumber.toString() + "." + jsCommandIndex.toString() + " - Response - " + evalResult.toString());
resp = resp + "<response>" + "0," + evalResult.toString() + "</response>\n";
}
catch (err)
{
UIALogger.logWarning("js command execution failed: " + err.description);
resp = resp + "<response>" + "-1," + err.description + "</response>\n";
}
}
}
catch (err)
{
UIALogger.logWarning("could not parse intruction set: " + err.description);
resp = resp + "<error>could not parse intruction set</error>\n";
}
resp = resp + "</collection>\n";
UIALogger.logDebug("INSTRUCTION SET #" + instructionNumber.toString() + " XML RESPONSE:\n\n" + resp + "\n");
host.performTaskWithPathArgumentsTimeout("/usr/bin/python", [ iosAutoPath + "writeResponse.py" ,responseFile, resp], 5);
UIALogger.logDebug("END INSTRUCTION SET #" + instructionNumber.toString());
instructionNumber++;
UIALogger.logDebug("BEGIN INSTRUCTION SET #" + instructionNumber.toString());
}
}
Oops, something went wrong.

0 comments on commit 9b89120

Please sign in to comment.