@jim said:
Yes, that is right. The time is in seconds, and the script will stop if it time out.
Do have a particular script in mind?
Not specific yet.
The global idea is that you can just hit a button (in a webdialog or in Sketchup itself) that immediately stops the ongoing script (like you said probably with the start and end_operation method)
If I understand your idea correctly, you will use an external button that will trigger the timeout, that one will countdown from 5 seconds and then execute the end_operation function?
With your idea i did some tests. The problem is i can't hit anything, not in a webdialog, nor in sketchup itself.
I have another function that is build like this:
execute script/start a timer
the timer checks each 2 seconds if the script has been executed
if so: execute the script again with different parametres
now like that i sometimes do have the possibility to hit a stop button i created (after each loop).
Here is the script:
def COMMON.play_timeintervallist #Automatically plays the whole Time Interval list
# set the play status to 1
$playing=1
#go forth one milestone to initiate the movie
COMMON.milestones_forward
#execute the milestones_forward command each 2 seconds
$playertimer=UI.start_timer(2, true) {
# first check if the previous milestones forward has finished, if so, go to the next milestone, continue counting till it is finished.
if $milestones_forward_exe==1
COMMON.milestones_forward
end
#stop the timer when $selected_delphidate= last date in milestoneslist
if $selected_delphidate==$milestones[-1][1]
COMMON.stop_timeintervallist
end
}
end
#--------------------------------------------------------------------------------------------
def COMMON.stop_timeintervallist #Stops the Time Interval list play
UI.stop_timer $playertimer
$playing=0
end
and a second part:
def COMMON.milestones_forward #Milestone navigation forward
#not yet executed (used in COMMON.play_timeintervallist)
$milestones_forward_exe=0
#if the milestoneslist had not been generated yet
if $milestones == nil
COMMON.create_timeintervallist
end
#get the current date
c_date=$selected_delphidate
#get the next milestone
#loop through the milestones list and see what date is higher then c_date
i=0
while i < $milestones.size
#split milestones[i] in 2 dates
_normaldate=$milestones[i][0]
_delphidate=$milestones[i][1]
#if c_date is smaller then a milestone delphidate then this milestone is the milestone to be shown
if c_date < _delphidate
$selected_date = _normaldate
$selected_delphidate = _delphidate
CreateConnection.call
ShowToDate.call($selected_delphidate)
DestroyConnection.call
#flag that it is initiated from milestone selection
$datefrommilestone=1
SHOW.showdate
break
end
i+=1
end
#executed (used in COMMON.play_timeintervallist)
$milestones_forward_exe=1
end
maybe it is possible to use something simular?