# # replay file for the xmeditor # which uses the motif.rules file # # clean out old edit file exec rm -f tmp # # open a new file called tmp # puts stdout "starting replay2 data file" # resetting of the topWidget is just to show how it is done. # without this, the widget name should be prefixed by ".main.menu_bar" setTopWidget menu_bar sleep 3000 cascadeButtonClick File sleep 1000 # note that a menu pane is parented by an invisible popup shell! # so need to '*' rather than '.' in path to it menuButtonClick *menu_pane1.New # set back to original topWidget setTopWidget $argv0 # 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 cascadeButtonClick main.menu_bar.File 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 menuButtonClick main.menu_bar*menu_pane1.Exit # 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!}