tooltip - Use AutoIt to call another AutoIt compiled executable with parameters -
i trying create program use multiple tooltips, came across problem: can use 1 @ time, because after that, new 1 replace previous.
i came solution: compile program creates tooltip , use as needed. there problem: want tooltips in different positions , different texts/titles.
to need use parameters or other types of variables change coordinates , text of tooltip.
my called exe perform simple like:
tooltip($text, $x, $y, $title, 0, 1 + 4) sleep(10000)
there quicker/easier way it.
the easiest way make use of /autoit3executeline
command line option, allows run 1 line of code command line. @ simplest implement this:
_showanothertooltip(1000, "hello", 100, 100) _showanothertooltip(1000, "world", 200, 200) func _showanothertooltip($time, $text, $x = default, $y = default, $title = "", $icon = default, $options = default) local $cmd = stringformat("tooltip(%s,%s,%s,%s,%s)", "'" & $text & "'", $x, $y, "'" & $title & "'", $icon, $options) run("""" & @autoitexe & """ /autoit3executeline ""sleep(" & $cmd & "*0+" & $time & ")""") endfunc ;==>_showanothertooltip
only real trickery here getting tooltip , sleep on 1 line. code generated like:
sleep(tooltip('hello', 100, 100, '', default, default)*0+1000)
depending on how computer is, see noticeable delay between 2 tooltips showing. if want have them show @ same time code gets bit more complicated:
if $cmdline[0] , $cmdline[1] = "/executeline" ; child script ; wait window appear winwait($cmdline[2]) ; execute line. execute($cmdline[3]) exit endif _addanothertooltip(1000, "hello", 100, 100) _addanothertooltip(1000, "world", 200, 200) _showthetooltips() func _showthetooltips() guicreate("showthosetooltipsnow") sleep(1000) endfunc ;==>_showthetooltips func _addanothertooltip($time, $text, $x = default, $y = default, $title = "", $icon = default, $options = default) local $cmd = stringformat("tooltip(%s,%s,%s,%s,%s)", "'" & $text & "'", $x, $y, "'" & $title & "'", $icon, $options) local $ipid if @compiled $ipid = run("""" & @autoitexe & """ /executeline showthosetooltipsnow ""sleep(" & $cmd & "*0+" & $time & ")""") else $ipid = run("""" & @autoitexe & """ """ & @scriptfullpath & """ /executeline showthosetooltipsnow ""sleep(" & $cmd & "*0+" & $time & ")""") endif processwait($ipid) endfunc ;==>_addanothertooltip
there better methods of interprocess communication 1 simple.
finally, there better way using guitooltip* functions.
Comments
Post a Comment