Page 1 of 1

print function in script

PostPosted:Sun Jul 29, 2018 4:56 am
by mamad
hi guys,
when i write
Code: Select all
 print("some thing"); 
in a script and run it using automation, where it print the text entered? i cant find any message box or console inside openkm to see the output
And one more question:
when i use
Code: Select all
 Window.alert("alert"); 
in a script and run it with an automation, nothing happens. why ?

Re: print function in script

PostPosted:Sun Jul 29, 2018 7:58 am
by jllort
Automation script is executed in the core into another thread that's why you will not see the output in the catalina.log file ( where usually is shown ). I do not suggest using scripting in automation , I suggest working with JAVA classes where you will get full control and you will be able to debug them https://docs.openkm.com/kcenter/view/ok ... ction.html

About Window.alert("alert"); only have sense from GWT classes.

I suggest debug the automation classes with eclipse, if you are not using the development environment also is good idea playing your code first there before working with production, in our download section you have explanation how getting the development environment working https://www.openkm.com/en/download.html

Re: print function in script

PostPosted:Mon Jul 30, 2018 3:49 am
by mamad
well , thank you

Re: print function in script

PostPosted:Thu Aug 02, 2018 4:02 am
by mamad
Hi again,
Guys is there any way to print something from non-Gwt classes ? i want it for some debug action.
I mean if i want to print some thing like what we do in java programming by using System.out.println() what i should do ?
For example i create a public class with a constructor inside com.openkm.frontend.client package that has Window.alert("***") code inside its constructor.so inside my java class i create a object from that class (i thought this will create a alert box) but this caused a lot of exceptions when i try to compile project.
is there any way for printing something for some debug purposes ??

Re: print function in script

PostPosted:Fri Aug 03, 2018 6:40 pm
by jllort
Automation classes will work with OpenKM default log, but for scripting should use the class FileLogger https://docs.openkm.com/kcenter/view/ok ... ogger.html

Re: print function in script

PostPosted:Mon Aug 06, 2018 4:39 am
by mamad
thank you