Mat Posted April 17, 2009 Share Posted April 17, 2009 (edited) I have a method: 1) On startup write a file to @Scriptdir & "\Undo.txt" 2) Every action writes to the file. 3) on ctrl-z, reads last line and deletes last line too. (so you can do it more than once.) 4) NO REDO FUNCTION 5) On end deletes the file This works (Just about, and its not too good), but doesn't include redo, and is very sloppy... my question is...Is there an easier way? Thanks MDiesel Edit: is it also possible to collect typing...eg if i type autoit, ctrl-z removes autoit, not t Edited April 17, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
martin Posted April 17, 2009 Share Posted April 17, 2009 I have a method:1) On startup write a file to @Scriptdir & "\Undo.txt"2) Every action writes to the file.3) on ctrl-z, reads last line and deletes last line too. (so you can do it more than once.)4) NO REDO FUNCTION5) On end deletes the fileThis works (Just about, and its not too good), but doesn't include redo, and is very sloppy...my question is...Is there an easier way?ThanksMDieselYou could write every action to an array and let the array grow as needed with ReDim. If you keep an index to the array then every new action adds to the array end of the array and increments the index to point to the last action. Every undo undoes the indexed action and decrements the index. Redo increments the index and repeats the action. A new action increments the index and overwrites anything that might be there so the current index becomes the end of the list so you can't redo after undoing a few steps and then changing what you did next. (Hope that makes sense.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Mat Posted April 17, 2009 Author Share Posted April 17, 2009 (edited) yep, that makes sense...And it should be a lot easier too...any idea on how to solve question 2? being able to collect typing poosibly? thats not as neccessary but would be nice...also @Martin: is this a problem for redim?The number of dimensions must remain the same, or the old array will be forgotten during the ReDimEdit: Arrayinsert possibly? Edited April 17, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
martin Posted April 17, 2009 Share Posted April 17, 2009 yep, that makes sense...And it should be a lot easier too... any idea on how to solve question 2? being able to collect typing poosibly? thats not as neccessary but would be nice... also @Martin: is this a problem for redim? Edit: Arrayinsert possibly?When it says that the number of dimensions vmust remain the same you shouldn't confuse that with the number of elements. For example, you can expand an array like this Dim $aa[1][2]=[["apples","mips"]];start with 1 row and 2 columns if you lkike to think of it like that Redim $aa[17][2];change to 17 rows and 2 columns without changing the existing contents ConsoleWrite($aa[0][0] & @CRLF) $aa[1][0] = "figs" $aa[1][1] = "bread" I'm not sure what you mean about every action but I would stear clear of anything that sounded like a key logger. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Mat Posted April 17, 2009 Author Share Posted April 17, 2009 I'm not sure what you mean about every action but I would stear clear of anything that sounded like a key logger.Thanks again!!Every action includes pasting, and deleting etc it is going to be used with an edit control. This isn't a keylogger I'm writing, its a notepad kind of thing with a couple of more specific features. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now