[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.00,0:00:02.00,Default,,0000,0000,0000,,Again this is fairly easy to realize, Dialogue: 0,0:00:02.00,0:00:05.00,Default,,0000,0000,0000,,because we already have a template up here. Dialogue: 0,0:00:05.00,0:00:08.00,Default,,0000,0000,0000,,So again, we have an index to the list of saved commands, Dialogue: 0,0:00:08.00,0:00:10.00,Default,,0000,0000,0000,,which we call saved command index. Dialogue: 0,0:00:10.00,0:00:13.00,Default,,0000,0000,0000,,So, at this moment we are in replay mode. Dialogue: 0,0:00:13.00,0:00:16.00,Default,,0000,0000,0000,,While we are in replay mode the original input command function Dialogue: 0,0:00:16.00,0:00:18.00,Default,,0000,0000,0000,,should no longer be called. Dialogue: 0,0:00:18.00,0:00:21.00,Default,,0000,0000,0000,,All of the commands should now come from the saved commands in here. Dialogue: 0,0:00:21.00,0:00:23.00,Default,,0000,0000,0000,,Let's see how this works. Dialogue: 0,0:00:23.00,0:00:26.00,Default,,0000,0000,0000,,We get the same set of commands now being read Dialogue: 0,0:00:26.00,0:00:28.00,Default,,0000,0000,0000,,from the saved commands variable. Dialogue: 0,0:00:28.00,0:00:31.00,Default,,0000,0000,0000,,You read a program that is outside of the webpage Dialogue: 0,0:00:31.00,0:00:34.00,Default,,0000,0000,0000,,one would now go and store the saved commands content Dialogue: 0,0:00:34.00,0:00:37.00,Default,,0000,0000,0000,,permanently, say in a file for recording and for replaying. Dialogue: 0,0:00:37.00,0:00:40.00,Default,,0000,0000,0000,,One would read this from a file. Dialogue: 0,0:00:40.00,0:00:43.00,Default,,0000,0000,0000,,For programs that take text based commands, Dialogue: 0,0:00:43.00,0:00:46.00,Default,,0000,0000,0000,,recording and replaying input is fairly easy to realize. Dialogue: 0,0:00:46.00,0:00:50.00,Default,,0000,0000,0000,,However, as it comes to reproducing graphical user interaction Dialogue: 0,0:00:50.00,0:00:55.00,Default,,0000,0000,0000,,it becomes hard to decide what of events to record and replay. Dialogue: 0,0:00:55.00,0:00:58.00,Default,,0000,0000,0000,,Suppose you have a graphical user interface for a web browser. Dialogue: 0,0:00:58.00,0:01:01.00,Default,,0000,0000,0000,,You have a captured replay tool that interposes itself Dialogue: 0,0:01:01.00,0:01:05.00,Default,,0000,0000,0000,,between the user and the program and stores all events Dialogue: 0,0:01:05.00,0:01:09.00,Default,,0000,0000,0000,,coming from the user in an event log such that they can be later replayed. Dialogue: 0,0:01:09.00,0:01:11.00,Default,,0000,0000,0000,,The problem is: What is the abstraction level Dialogue: 0,0:01:11.00,0:01:14.00,Default,,0000,0000,0000,,you're going to chose for your events? Dialogue: 0,0:01:14.00,0:01:17.00,Default,,0000,0000,0000,,You could, for instance, go and record mouse clicks to gather with Dialogue: 0,0:01:17.00,0:01:19.00,Default,,0000,0000,0000,,the coordinates of the mouse pointer. Dialogue: 0,0:01:19.00,0:01:21.00,Default,,0000,0000,0000,,This is fairly easy to record. Dialogue: 0,0:01:21.00,0:01:26.00,Default,,0000,0000,0000,,So, for instance, you could go and click here on search Dialogue: 0,0:01:26.00,0:01:30.00,Default,,0000,0000,0000,,at the position, say 100x and 300y. Dialogue: 0,0:01:30.00,0:01:36.00,Default,,0000,0000,0000,,Or, you could enter some text while the cursor is in the position 200 and 50. Dialogue: 0,0:01:36.00,0:01:41.00,Default,,0000,0000,0000,,Click here on the file menu or here down on this roll-down menu. Dialogue: 0,0:01:41.00,0:01:44.00,Default,,0000,0000,0000,,Of course, all of these then go into the event log. Dialogue: 0,0:01:44.00,0:01:48.00,Default,,0000,0000,0000,,The problem is that for replaying, you need to have the exact Dialogue: 0,0:01:48.00,0:01:54.00,Default,,0000,0000,0000,,same position of every element at the very same position on the screen. Dialogue: 0,0:01:54.00,0:01:58.00,Default,,0000,0000,0000,,Now suppose your screen resolution changes. or the font size changes. Dialogue: 0,0:01:58.00,0:02:02.00,Default,,0000,0000,0000,,Then some of the elements will still be more or less in their original positions, Dialogue: 0,0:02:02.00,0:02:04.00,Default,,0000,0000,0000,,but others won't. Dialogue: 0,0:02:04.00,0:02:07.00,Default,,0000,0000,0000,,We knew that the mouse click, which previously activated Dialogue: 0,0:02:07.00,0:02:10.00,Default,,0000,0000,0000,,a particular button on the screen, will no longer work Dialogue: 0,0:02:10.00,0:02:13.00,Default,,0000,0000,0000,,Likewise, if the position of some elements change, Dialogue: 0,0:02:13.00,0:02:16.00,Default,,0000,0000,0000,,then as well, the recorded events will no longer work. Dialogue: 0,0:02:16.00,0:02:19.00,Default,,0000,0000,0000,,Also, timing can become an issue. Dialogue: 0,0:02:19.00,0:02:22.00,Default,,0000,0000,0000,,Suppose you recorded a click on this drop-down menu. Dialogue: 0,0:02:22.00,0:02:25.00,Default,,0000,0000,0000,,Half a second later, when the drop-down menu appeared, Dialogue: 0,0:02:25.00,0:02:27.00,Default,,0000,0000,0000,,you clicked on one of the elements in here. Dialogue: 0,0:02:27.00,0:02:29.00,Default,,0000,0000,0000,,So far, so good. Dialogue: 0,0:02:29.00,0:02:31.00,Default,,0000,0000,0000,,This is what you recorded. Dialogue: 0,0:02:31.00,0:02:33.00,Default,,0000,0000,0000,,Now when you're replaying, and in particular, Dialogue: 0,0:02:33.00,0:02:35.00,Default,,0000,0000,0000,,when you are replaying something from a web page, Dialogue: 0,0:02:35.00,0:02:38.00,Default,,0000,0000,0000,,it may be that there are delays, Dialogue: 0,0:02:38.00,0:02:41.00,Default,,0000,0000,0000,,and the drop-down menu will not appear on time. Dialogue: 0,0:02:41.00,0:02:44.00,Default,,0000,0000,0000,,Then you'd be clicking somewhere completely different when replaying Dialogue: 0,0:02:44.00,0:02:47.00,Default,,0000,0000,0000,,the recorded events, which stipulate Dialogue: 0,0:02:47.00,0:02:50.00,Default,,0000,0000,0000,,that after half a second you'd click in this very position. Dialogue: 0,0:02:50.00,0:02:53.00,Default,,0000,0000,0000,,Finally, of course, the program itself may change. Dialogue: 0,0:02:53.00,0:02:55.00,Default,,0000,0000,0000,,If the search button is moved from down here to up here, Dialogue: 0,0:02:55.00,0:02:58.00,Default,,0000,0000,0000,,then again replaying the event log based on absolute coordinates Dialogue: 0,0:02:58.00,0:03:00.00,Default,,0000,0000,0000,,will click in the wrong position.