1 Reply Latest reply on Jul 29, 2009 5:18 AM by [Jongware]

    Repeat last action

    Ildhund Level 3

      The lack of a single keyboard shortcut (KBSC) for 'repeat last action' akin to Ctrl-Y in MS Office has bugged me ever since I started using ID two years ago. The question arises once in a while in the general forum, and the questioner is usually directed to the eyedropper, Quick apply, Step and repeat and KBSCs for formatting options, and to plug-ins like MultiDo or scripts like Harbs's 'Redo'. All of these have their uses, but none has the power of 'repeat last action' in Office. One of the problems is that 'redo' means something different in ID from what it means in Office; in ID, I think it means only "undo the effect of my last 'undo' command," a useful way (by toggling Undo/Redo) of examining all the effects of a particular action. In Office, it means "do again whatever I did last," and I use it all the time. So now I'm appealing to the scripting genii out there either to come up with the script we're looking for, or to point out how it might be done, or to explain why it can't be done. As I see it, a script would have to:


      1. run on opening a document

      2. whenever a page item is selected, note and store what type of selection it is (text, graphic, frame, cell, for example)

      3. record if possible whatever is done to that item as a series of properties/methods - just like the Undo function does

      4. if the next selection is of the same type as at (2), wait for the user to input the KBSC for 'repeat' or make a new selection

      5. given that input, perform the same actions on the current selection as were recorded at (3)

      6. if the current selection is of a different type, wait to see if the user does anything to it

      7. if so, go back to (2). A new set of actions is recorded

      8. if not, go back to (4)


      I quite understand that script alone might not be able to handle all of these stages, but looks like APID might present some possibilities. Here are two simple things I can do very easily in Office but not so easily in ID:


      • Select a word and apply a different font, character style and kerning, then select another word and hit Ctrl-Y to apply the same attributes to that word

      • Select a column in an Excel spreadsheet, change the number format and adjust its width to fit. Select some other columns and hit Ctrl-Y to make them all the same width with the same number format.


      What do you say? Noel

        • 1. Re: Repeat last action
          [Jongware] Most Valuable Participant

          I'm sorry to say, but I think it already comes to a dead stop at point #2 -- for scripts, that is. The APID can do a lot, but at this level?


          A real plug-in should be able to do this. You could drop a hint towards this post in the SDK forum; however, I doubt someone will pick up on it for the mere thrill of it! A plug-in has access to all internal and external events, so in theory writing one should be "a day at the beach, a picnic, a walk in the park, & a sunday stroll all rolled into one" (to quote one of my favourite authors). But remember, it has to monitor all internal and external events ...