using gs.sleep in a scoped application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 03:39 AM
Hi,
I'm trying to use gs.sleep (1000) in a scoped application and I keep getting an exception:. com.glide.script.fencing.MethodNotAllowedException: Function sleep is not allowed in scope "xxx"
I've tried "GlideSystem.sleep(1000); " but get a similar exception: java.lang.SecurityException: GlideSystem is not allowed in scoped applications exception.
Anyone have any hints.
Thanks,
D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 08:44 AM
I've found some other references (look at the HTML source for the code) to using Java directly.
Packages.java.lang.Thread.sleep(1000);
What do you think....
D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 09:27 AM
D,
I tried
Packages.java.lang.Thread.sleep(1000);
Evaluator: java.lang.SecurityException: Use of Packages calls is not permitted in scoped applications Caused by error in script at line 1 ==> 1: Packages.java.lang.Thread.sleep(10000);
Evaluator: java.lang.SecurityException: Use of Packages calls is not permitted in scoped applications Caused by error in script at line -1
Background message, type:error, message: Use of Packages calls is not permitted in scoped applications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 01:19 AM
Ouch.
Thanks for testing for me. I wonder if there is a different solution.
D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2017 02:58 AM
Hi,
I had the same Problem.
I created a Script Include in Global Scope, Accessible from All AplicationScopes:
var MyGlobalScopeUtils = Class.create();
MyGlobalScopeUtils.prototype = {
initialize: function() {
},
/** Wrapper for gs.sleep
*
* @param {Integer} duration in ms
*/
sleep: function (duration) {
gs.sleep(duration);
},
type: 'MyGlobalScopeUtils'
};
In my scoped scripts I can use
var globalUtils = new global.MyGlobalScopeUtils(); // I forgot "global." thanks to ryangarrett for the remark
globalUtils.sleep(1000);
Regards
Sven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 08:56 AM
Seven,
With a minor adjustment, that worked perfect, Thank you.
Don't forget to use the global qualifier when you call it from a scoped application
var globalUtils = new global.MyGlobalScopeUtils();
- globalUtils.sleep(180000);
Best,
Ryan