The easiest way to do this is to make use of the /AutoIt3ExecuteLine
command line option, which allows you to run 1 line of code from the command line. At its simplest you could implement it like 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 is getting the tooltip and sleep on one line. The code generated will look something like:
Sleep(ToolTip('Hello', 100, 100, '', Default, Default)*0+1000)
Depending on how good your computer is, you will probably see a noticeable delay between the two tooltips showing. If you want to have them all show at the same time then the code gets a bit more complicated:
If $CmdLine[0] And $CmdLine[1] = "/ExecuteLine" Then
; This is the child script
; Wait for the window to appear
WinWait($CmdLine[2])
; Then execute the 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 Then
$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 are better methods of interprocess communication but this one is very simple.
Finally, there is probably a better way to do it using the GUITooltip* functions.