# # replay file for the xmeditor # # clean out old edit file exec rm -f tmp # # open a new file called tmp # sleep 3000 warpPointer main.menu_bar.File 10 10 sleep 1000 callActionProc main.menu_bar.File MenuBarSelect() \ -type ButtonPress \ -button Button1 \ -x 0 -y 0 sleep 1000 callActionProc main.menu_bar.File DoSelect() \ -type ButtonRelease \ -x 0 -y 0 sleep 1000 # note that a menu pane is parented by an invisible popup shell! # so need to '*' rather than '.' in path to it warpPointer main.menu_bar*menu_pane1.New 10 10 sleep 1000 callActionProc main.menu_bar*menu_pane1.New BtnDown() \ -type ButtonPress \ -x 0 -y 0 sleep 500 callActionProc main.menu_bar*menu_pane1.New BtnUp() \ -type ButtonRelease \ -x 0 -y 0 # The menu file dialog name has spaces in it, so enclose in {} # Note also the invisible dialog shell parenting menu pane # The text object is (undocumented) a TextField so we must insert # 1 char at a time. This should be a proc in "rules" file # enter the name "tmp" into the text field sleep 1000 callActionProc {main*new file dialog.Text} self-insert() \ -type KeyPress \ -keysym t sleep 300 callActionProc {main*new file dialog.Text} self-insert() \ -type KeyPress \ -keysym m sleep 300 callActionProc {main*new file dialog.Text} self-insert() \ -type KeyPress \ -keysym p sleep 300 # press the key to activate the dialog # see how to press the OK button on the exit_dialog later callActionProc {main*new file dialog.Text} activate() \ sleep 1000 # enter a slab of text into the main Text area, holding a Text widget # note including the action in {} due to spaces in text callActionProc main.textSW.text {insert-string("the rain in Spain falls mainly in the plain")} # now try to exit by bringing up the menu again and selecting Exit sleep 3000 warpPointer main.menu_bar.File 10 10 sleep 1000 callActionProc main.menu_bar.File MenuBarSelect() \ -type ButtonPress \ -button Button1 \ -x 0 -y 0 sleep 1000 callActionProc main.menu_bar.File DoSelect() \ -type ButtonRelease \ -x 0 -y 0 sleep 1000 # note that a menu pane is parented by an invisible popup shell! # so need to '*' rather than '.' in path to it # could just do "*Exit" if unambiguous warpPointer main.menu_bar*menu_pane1.Exit 10 10 sleep 1000 callActionProc main.menu_bar*menu_pane1.Exit BtnDown() \ -type ButtonPress \ -x 0 -y 0 sleep 500 callActionProc main.menu_bar*menu_pane1.Exit BtnUp() \ -type ButtonRelease \ -x 0 -y 0 # waiting for dialog to be realised sleep 2000 # this notes that the file has not been saved so brings up # a warning dialog. We select "save" getValues *exit_warning*OK \ -x x -y y -width w -height h set x_mid [expr {$x + $w/2}] set y_mid [expr {$y + $h/2}] warpPointer main*exit_warning $x_mid $y_mid sleep 1000 callActionProc main*exit_warning ManagerGadgetArm() \ -type ButtonPress -x $x_mid -y $y_mid sleep 1000 callActionProc main*exit_warning ManagerGadgetActivate() \ -type ButtonRelease -x $x_mid -y $y_mid puts stdout {replay done!}