bg5
2013-10-29 23:14:54
@nielsie95 hasn't told you that, but APPA has ability to inject JavaScript code into site, like e.x. firefox's console. So when writing script in APPA you have all that superpowers, which JS provides to your browser.
NOTE:
JS standards of IE (on which APPA is based) are at some points a little different then in FF.
You don't have debugger, which would tell you why function doesn't work properly. So test your code somewhere else before you put it into script (for example here or use FF/chrome console.
This is like normal procedure. Doesn't return value and runs JS code asynchronously.
This runs JS code and returns result. This function is synchro ,so Simba will wait until it finish!
As first string you put JS code to exec. As second argument you put the name of variable (same as in JS code),of which value will be returned to Simba.
Loads into the site external JS library from URL. So you don't need to write all those functions in Simba.
Gets x,y coords of object of given ID. This is just an example of function, which does something more complex. I haven't made more, because I haven't seen a point yet.
This is an open project: Feel free to copy ,modify and use this code, also share your own functions and ideas.
NOTE:
JS standards of IE (on which APPA is based) are at some points a little different then in FF.
You don't have debugger, which would tell you why function doesn't work properly. So test your code somewhere else before you put it into script (for example here or use FF/chrome console.
This is like normal procedure. Doesn't return value and runs JS code asynchronously.
procedure appaExecJS (JScode:string);
Example:appaExecJS( 'document.write("Hello World!");' );This runs JS code and returns result. This function is synchro ,so Simba will wait until it finish!
As first string you put JS code to exec. As second argument you put the name of variable (same as in JS code),of which value will be returned to Simba.
function appaExecJSFunc (JScode,JSResultName:string) : string;
Example:msg := appaExecJSFunc('var a =8; var b= 10; var res=a+b;','res');
writeln('8 + 10 = '+msg;)
Example2:
str1 := "Hello";
str2 := "World";
msg := appaExecJSFunc('var a ="'+str1+'" ; var b="'+str2+'"; var MyStr = a+" "+b+" "+"of JS !";','MyStr');
writeln(msg);Loads into the site external JS library from URL. So you don't need to write all those functions in Simba.
procedure appaLoadJSLib (url : string);
Gets x,y coords of object of given ID. This is just an example of function, which does something more complex. I haven't made more, because I haven't seen a point yet.
procedure GetDOMObjPos (var x,y:integer; objectID:string);
This is an open project: Feel free to copy ,modify and use this code, also share your own functions and ideas.