on 02-11-2021 1:56 PM
Hello Experts,
I am generating a message on screen in text box after that I want it to be vanish in 1 second and carry out further steps in script.
I see a similar question but the reply by expert @ chinthan.yajamaan in it gives reference of another post which i am unable to locate.
Appreciate you replies.
Thanks
RD
Hi Ritesh,
You can use the JavaScript Window setTimeout function to execute a script that clears the message after the given time in milliseconds.
1) Create an SAP Screen Personas script that clears the message, for example:
session.findById("wnd[0]/usr/txtPersonas_161305201704022").text = "Cleared!";
2) Create a script that features a timer and calls the previous script asynchronously to clear the message
session.findById("wnd[0]/usr/txtPersonas_161305201704022").text = "Message!";
setTimeout(function(){
session.utils.executeScriptAsync("wnd[0]/scrptPersonas_42010AEEDAD41EDB9B8E51F86BC5303B");
}, 1000);
Hope that helps!
Best regards,
Krists Magons
SAP Screen Personas Dev team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can i combine all ( generation and clearance) in my current script only?
as my trigger start with one push button by user. once start it perform few steps an generates a success message in botton message bar, from there I am collecting the message and passing it to text field on screen. here i wan it to be displayed for 1 second and then disappear and go to next steps.
Thanks
RD
JavaScript is executed in a single thread and most of the property changes such as the text property generate async network requests, therefore, to ensure the request responses do not interfere with your timers, I highly recommend to use session.utils.executeScriptAsync along with a separate script that implements the logic to be executed after the timer.
Thanks,
Krists
kmagons,
It work out finally . Thank you friend , you are awesome . 🙂
Thanks
RD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, he is 🙂
kmagons,
I tried with below but after message appear on screen its going in loop and hang there. 😞
also for setTimeout it gives below error
so i even added /* globals setTimeout */ , flavour got saved but aftertward it shows same error again and it didnt show the declaration (/* globals setTimeout */) i added previously.
Thanks
RD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ritesh,
The window.setTimeout method is available globally. Either ignore the warning or add /*globals setTimeout*/ to the top of the function that leverages setTimeout call to suppress the warning.
You are calling the same script recursively every second to the point when the recursion stack is full 🙂 You need to have at least 2 SAP Screen Personas scripts:
- One that sets the timer through the setTimeout function
- The other that implements the logic to be executed when the timer is done
In the first script, use session.utils.executeScriptAsync and pass the other's script's ID to call logic that should be executed when the timer is over.
Thank you!
Krists Magons
SAP Screen Personas Dev Team
kmagons,
I am trying below all in same script but some how its not working , also i am not sure which object id should i pass in last line. Pasted below all three steps. Please share your thoughts.
// collect task bar message in "message"
var message = session.findById("wnd[0]/sbar").text;
// pass task bar message to custom filed on screen session.findById("wnd[0]/usr/subPersonas_161304253978389/txtPersonas_161304262034397").text=message;
// call clear message function after 1000 milisecond
setTimeout(function(){ session.utils.executeScriptAsync(" which parameter should i specify here ? "); }, 1000);
Thanks
RD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.