Federico Verrastro Posted February 18, 2020 Share Posted February 18, 2020 Hi, I have a question regarding a funtionality of Buttons in text areas and IronPython Scripts. I have a date range filter and I want it to automaticaly update every 2 seconds (like a timelapse). The idea is to view the data as it came in. I tried implementing this code but it only updates once it is done: import time x = DateMin while x < DateMax: time.sleep(2) x = x.AddHours(3) rangeFilter.ValueRange = ValueRange(DateMin,x) Being DateMax and DateMin the low and high of the datefilter. At first I had a problem with the condition but I also tried implementing with a "for i in range(10)" loop and the result is shown only at the end of the loop (it actualy takes 20s to run it). Is there a way for it to update on every step I also tried checking and unchecking the "Execute in transaction" box but to no avail. Kind regards, Federico Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted February 19, 2020 Share Posted February 19, 2020 You might have to use a JavaScript to trigger the IronPython script instead of sleep() in the script. To do this, 1. Wrap your button in text area around a div with an id say 'myBtn' 2. Insert a JavaScript as setInterval(function () { $("#myBtn .sf-element ").trigger("click"); }, 20000); There are certain limitations of using javascripts like above and these scripts must be tested in each version and not something officially supported Link to comment Share on other sites More sharing options...
Federico Verrastro Posted February 20, 2020 Author Share Posted February 20, 2020 Thank you, it did work!! The only further question i would have is how to make it stop, it keeps runing whatever I do. I'm not literate in JS and i can't find a way of controling it with IronPython. Edit: I've tried adding a property control dropdown input box which id = "OnOff" and tried the following code: var OnOff = $("#OnOff .ComboBoxTextDivContainer div").text() alert('Drop down >> ' + OnOff) while (OnOff == "True") { setInterval(function () { $("#myBtn .sf-element ").trigger("click"); }, 2000); } However it doesnt work. I dont really understand why though. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now