{"id":6378,"date":"2022-12-20T18:58:15","date_gmt":"2022-12-20T21:58:15","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/after-mann\/"},"modified":"2022-12-20T18:58:15","modified_gmt":"2022-12-20T21:58:15","slug":"after-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/after-mann\/","title":{"rendered":"after (mann)"},"content":{"rendered":"<h1 align=\"center\">after<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">after \u2212 Execute a command after a time delay<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after<\/b> <i>ms<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after<\/b> <i>ms<\/i> ?<i>script script script &#8230;<\/i>?<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after cancel<\/b> <i>id<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after cancel<\/b> <i>script script script &#8230;<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after idle<\/b> ?<i>script script script &#8230;<\/i>?<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>after info<\/b> ?<i>id<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This command is used to delay execution of the program or to execute a command in background sometime in the future. It has several forms, depending on the first argument to the command: <b><br \/> after<\/b> <i>ms<\/i><\/p>\n<p style=\"margin-left:22%;\"><i>Ms<\/i> must be an integer giving a time in milliseconds. The command sleeps for <i>ms<\/i> milliseconds and then returns. While the command is sleeping the application does not respond to events.<\/p>\n<p style=\"margin-left:11%;\"><b>after<\/b> <i>ms<\/i> ?<i>script script script &#8230;<\/i>?<\/p>\n<p style=\"margin-left:22%;\">In this form the command returns immediately, but it arranges for a Tcl command to be executed <i>ms<\/i> milliseconds later as an event handler. The command will be executed exactly once, at the given time. The delayed command is formed by concatenating all the <i>script<\/i> arguments in the same fashion as the <b>concat<\/b> command. The command will be executed at global level (outside the context of any Tcl procedure). If an error occurs while executing the delayed command then the background error will be reported by the command registered with <b>interp bgerror<\/b>. The <b>after<\/b> command returns an identifier that can be used to cancel the delayed command using <b>after cancel<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>after cancel<\/b> <i>id<\/i><\/p>\n<p style=\"margin-left:22%;\">Cancels the execution of a delayed command that was previously scheduled. <i>Id<\/i> indicates which command should be canceled; it must have been the return value from a previous <b>after<\/b> command. If the command given by <i>id<\/i> has already been executed then the <b>after cancel<\/b> command has no effect.<\/p>\n<p style=\"margin-left:11%;\"><b>after cancel<\/b> <i>script script &#8230;<\/i><\/p>\n<p style=\"margin-left:22%;\">This command also cancels the execution of a delayed command. The <i>script<\/i> arguments are concatenated together with space separators (just as in the <b>concat<\/b> command). If there is a pending command that matches the string, it is canceled and will never be executed; if no such command is currently pending then the <b>after cancel<\/b> command has no effect.<\/p>\n<p style=\"margin-left:11%;\"><b>after idle<\/b> <i>script<\/i> ?<i>script script &#8230;<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Concatenates the <i>script<\/i> arguments together with space separators (just as in the <b>concat<\/b> command), and arranges for the resulting script to be evaluated later as an idle callback. The script will be run exactly once, the next time the event loop is entered and there are no events to process. The command returns an identifier that can be used to cancel the delayed command using <b>after cancel<\/b>. If an error occurs while executing the script then the background error will be reported by the command registered with <b>interp bgerror<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>after info<\/b> ?<i>id<\/i>?<\/p>\n<p style=\"margin-left:22%;\">This command returns information about existing event handlers. If no <i>id<\/i> argument is supplied, the command returns a list of the identifiers for all existing event handlers created by the <b>after<\/b> command for this interpreter. If <i>id<\/i> is supplied, it specifies an existing handler; <i>id<\/i> must have been the return value from some previous call to <b>after<\/b> and it must not have triggered yet or been canceled. In this case the command returns a list with two elements. The first element of the list is the script associated with <i>id<\/i>, and the second element is either <b>idle<\/b> or <b>timer<\/b> to indicate what kind of event handler it is.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>after<\/b> <i>ms<\/i> and <b>after idle<\/b> forms of the command assume that the application is event driven: the delayed commands will not be executed unless the application enters the event loop. In applications that are not normally event-driven, such as <b>tclsh<\/b>, the event loop can be entered with the <b>vwait<\/b> and <b>update<\/b> commands.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This defines a command to make Tcl do nothing at all for <i>N<\/i> seconds:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">proc sleep {N} { <b><br \/> after<\/b> [expr {int($N bodies manpages.csv script_extrae_body.sh script.sh usr 1000)}] <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This arranges for the command <i>wake_up<\/i> to be run in eight hours (providing the event loop is active at that time):<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>after<\/b> [expr {1000 bodies manpages.csv script_extrae_body.sh script.sh usr 60 bodies manpages.csv script_extrae_body.sh script.sh usr 60 bodies manpages.csv script_extrae_body.sh script.sh usr 8}] wake_up<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The following command can be used to do long-running calculations (as represented here by <i>::my_calc::one_step<\/i>, which is assumed to return a boolean indicating whether another step should be performed) in a step-by-step fashion, though the calculation itself needs to be arranged so it can work step-wise. This technique is extra careful to ensure that the event loop is not starved by the rescheduling of processing steps (arranging for the next step to be done using an already-triggered timer event only when the event queue has been drained) and is useful when you want to ensure that a Tk GUI remains responsive during a slow task.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">proc doOneStep {} { <br \/> if {[::my_calc::one_step]} { <b><br \/> after idle<\/b> [list <b>after<\/b> 0 doOneStep] <br \/> } <br \/> } <br \/> doOneStep<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">concat(n), interp(n), update(n), vwait(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">cancel, delay, idle callback, sleep, time<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  after \u2212 Execute a command after a time delay <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2950,2635],"class_list":["post-6378","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-after","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6378"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6378\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}