terrypin Posted April 1, 2009 Report Share Posted April 1, 2009 I'm getting erratic behaviour with macros like this when I try to run them in debug mode (F9 and Enter). Open Folder to "C:\Test Folder" // Open a folder Window Activate: Test folder Wait for Window Title: Test folder Text Type (Simulate Keystrokes): <ALT>to // Open Folder Options Delay: 100 milliseconds Macro Return <OPEN FOLDER Path="C:\\Test Folder" _COMMENT="Open a folder"/> <WINDOW ACTIVATE Title="Test folder" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/> <WAIT FOR WINDOW TITLE Title="Test folder" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/> <TEXT TYPE Action="0" Text="<ALT>to" _COMMENT="Open Folder Options"/> <DELAY Flags="\x02" Time="100"/> <MACRO RETURN/> Sometimes it doesn't apply the Text Type keystrokes at all, and sometimes it applies them to the Script Editor instead of the target folder, resulting in the Notes tab being opened and sometimes getting a spurious 'o' entered. Results may vary (but are never correct) if I disable either the Activate or Wait commands. Nor does it matter whether I use Exact or Partial Match conditions. It's as if Script Editor persistently steals focus, despite the explicit commands that should prevent this. If this is a more general issue, not just confined to Open Folder, then it might explain other weird behaviour I've had when debugging. If I run from a hotkey the macro works OK, from anywhere, including Script Editor. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Cory Posted April 1, 2009 Report Share Posted April 1, 2009 I don't think you should need the Activate and Wait For commands. Quote Link to comment Share on other sites More sharing options...
terrypin Posted April 1, 2009 Author Report Share Posted April 1, 2009 I don't think you should need the Activate and Wait For commands. Nor me, I added them to see if either of them solved the problem. But with or without either or both of them, it persists. Could you try it please? Just create an empty folder C:\Test Folder and from Script Editor using F9 > Enter run this: Open Folder to "C:\Test Folder" // Open a folder Text Type (Simulate Keystrokes): <ALT>to // Open Folder Options Delay: 100 milliseconds Macro Return <OPEN FOLDER Path="C:\\Test Folder" _COMMENT="Open a folder"/> <TEXT TYPE Action="0" Text="<ALT>to" _COMMENT="Open Folder Options"/> <DELAY Flags="\x02" Time="100"/> <MACRO RETURN/> Here, as described, it fails to apply the keystrokes to the opened folder, but instead applies them to the Script Editor. Usually (not always) that results in the macro's Notes tab being opened and the letter 'o' entered in it. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Cory Posted April 1, 2009 Report Share Posted April 1, 2009 I get the same thing and I'm not sure how to do a smart delay. I used a 2 second delay to get it to work. I use Vista and do not have window titles I could wait for. I was thinking of a control but if you have other Explorer windows open that could fail too. The only smart way I can think of is to enable the path to be shown in the Window Title and use classic Explorer windows. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.