why ParseInt returning value in different format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 03:34 PM
Hi All,
SCript Inlcude :
var SleepForScoppedApp = Class.create();
SleepForScoppedApp.prototype = {
initialize: function() {},
sleep: function(time) {
gs.sleep(time);
},
type: 'SleepForScoppedApp'
};
System Property's :
name : holdforfewSeconds , type: integer value : 10000
name : refreshseconds, type:integer value:3000
widget :
var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds') : parseInt(gs.getProperty('holdforfewSeconds');
gs.addInfoMessage(ms) ;
new global.SleepForScoppedApp().sleep(ms);
why Info Message coming like 10000.0 ???? why .0 coming after 10000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 02:58 PM - edited 07-10-2024 03:44 PM
If I'm not wrong , I believe I'm doing below in proper way. right ?
var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds') : parseInt(gs.getProperty('holdforfewSeconds');
new global.SleepForScoppedApp().sleep(ms);
Can I go-ahead with this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 04:28 PM - edited 07-10-2024 04:28 PM
Hi @Supriya25 ,
You are almost right except that you are not closing the brackets for parseInt() properly,
Here is the updated code-
var ms = input.recheck ? parseInt(gs.getProperty('refreshseconds')) : parseInt(gs.getProperty('holdforfewSeconds'));
gs.addInfoMessage(ms.toString()); // Ensure it's displayed as an integer
new global.SleepForScoppedApp().sleep(ms);
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 04:28 PM
Thanks for joining and sharing your inputs