rberq Posted May 13, 2009 Report Share Posted May 13, 2009 I have tried several times to use TEXT TYPE with the checkbox "Use Clipboard to Paste Text". When it works it is wonderfully fast. However, often I wind up with just the letter "v", either upper or lower case, in the target location. It's as if the macro uses the CTRL_v sequence to paste the data, but the CTRL part gets lost and it just types the letter "v". I have preferences set to zero delay after clipboard commands. Ideas, anyone? Except don't ask me to set a clipboard delay -- that is zero for good reason and has to stay zero. Quote Link to comment Share on other sites More sharing options...
paul Posted May 14, 2009 Report Share Posted May 14, 2009 In my experience, setting a clipboard delay of 0 is exactly the reason why you are getting the problem. generally, Windows clipboard operations are slow and unreliable. Setting ME to one side, I can often select some text and press Ctrl-C (I use ClipMate, so I can hear if the copy has worked). Often, I hear nothing on the first attempt; sometimes it takes me 3 or 4 goes before it "takes". If I experience that manually, what chance has ME got? Quote Link to comment Share on other sites More sharing options...
monpasdg Posted May 14, 2009 Report Share Posted May 14, 2009 In my experience, setting a clipboard delay of 0 is exactly the reason why you are getting the problem. generally, Windows clipboard operations are slow and unreliable. Setting ME to one side, I can often select some text and press Ctrl-C (I use ClipMate, so I can hear if the copy has worked). Often, I hear nothing on the first attempt; sometimes it takes me 3 or 4 goes before it "takes". If I experience that manually, what chance has ME got? I have a fix for this. I use it as a function because its rather lengthly and pasting this in every time Ctrl + C makes for a long code. I just call the macro below to do all the clipboard coping and T1 is set to the clipboard contents. First there is a loop to do clipboard copy 5 times to make sure there is something on the clipboard Inside the clipboard copy loop is a loop that makes sure something is on the clipboard If something is on the clipboard the loops are exited and another loop is entered This second loop makes sure that the variable set from the clipboard is exactly what was on the clipboard Since windows uses a buffer for the clipboard i have experienced variables only getting half the clipboard, the second repeat fixes this. <REM2:++==========================================================++><REM2:*-^*-^*-^*-^*-^*-^*-^*-^*-^*-Macro Title-^*-^*-^*-^*-^*-^*-^*-^*-^*-^*-^*-^><REM2: Macro Title Function: Clipboard Copy (Advanced)><REM2: ><REM2: ><REM2:*-^*-^*-^*-^*-^*-^*-^*-^*-^*-Description-^*-^*-^*-^*-^*-^*-^*-^*-^*-^*-^*-^><REM2: Macro Description ><REM2: 1. Initiate the CTRL + C><REM2: 2. Wait for something is on the clipboard><REM2: 3. Verify that the clipboard is exactly what was set in the variable><REM2: ><REM2:~`~`~`~`~`~`~`~`~`~`~`~`Author`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`><REM2:.-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨).-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨)><REM2:(¸.-´ (¸.-´ (¸.-` (¸.-´(¸.-´ (¸.- Donald (¸.-´ (¸.-´-´(¸.- (¸.-´(¸.-´ -´(¸.- (¸.-´(¸.-´-´(¸.-><REM2:.-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨).-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨)><REM2: (¸.-´ (¸.-´-´(¸.- (¸.-´Monpas (¸.-´-´(¸.-´ (¸.-´-´(¸.-(¸.-´ -´(¸.- (¸.-´(¸.-´-´(¸.-(¸.-´(¸.-´><REM2:.-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨).-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨)><REM2: (¸.-´(¸.-(¸.-´-´(¸.- (¸.-´ (¸.-´-´04/17/09 -´ (¸.-´(¸.- (¸.-´ -´(¸.-(¸.-´(¸.-´ -´(¸.-(¸.-´(¸.-><REM2:.-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨).-*´¨) ¸.-*¨) ¸.-´¸.-*´¨) ¸.-*¨) ¸.-¸.-*´¨)¸.-*¨)><REM2:~`~`~`~`~`~`~`~`~`~`~`~`Mods`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`><REM2: MOD: User Name, Date, Description of Mod><REM2: ><REM2: ><REM2:++==========================================================++><REM2:><REM2:><REM2:><REM2:><REM2:-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-><REM2: Variables><REM2:-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-><REM2:T1: Variable returned with clipboard contents><REM2:><REM2:><REM2:-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-><REM2: Variables><REM2:-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-><REM2:><REM2:><REM2:><REM2:><REM2:5 Attempts to get something on the clipboard><REP3:01:000001:000001:00005:0:01:><REM2:Note: DO Not use Clipboard Empty with Excel 2004, chance of crashing><CLIPE><CLIPC><REM2:><REM2:Wait 1 second (200 repeats 5 millisecond delay) for something to appear on clipboard><REP3:01:000001:000001:00200:0:01:><REM2:Make sure that there is something on the clipboard before continuing><IFOTH2:07:1:><MSD:5><ELSE><REM2:Clipboard has something exit><EXITREP><ENDIF><REM2:><ENDREP><REM2:><IFOTH2:07:1:><REM2:If there is nothing on the clipboard, repeat><ELSE><REM2:Clipboard has something exit the "5 attempts" Repeat><EXITREP><ENDIF><ENDREP><REM2:><REM2:><REM2:Since the clipboard works with a buffer sometimes (very small chance) ><REM2:the clipboard will only half copy to a variable, this loop makes sure that><REM2:the variable is exactly whats on the clipboard><REP3:01:000001:000001:01000:0:01:><REM2:If clipboard is blank there is not point in this loop><IFOTH2:07:1:><EXITREP><ENDIF><REM2:><TVAR2:01:03:><REM2:><REM2:Makes sure that T1 is properly set><IFOTH2:07:1:%T1%><EXITREP><ENDIF><ENDREP><REM2:><REM2:> Quote Link to comment Share on other sites More sharing options...
paul Posted May 14, 2009 Report Share Posted May 14, 2009 Yes, I wrote and publushed some code a while back that is remarkably similar. Quote Link to comment Share on other sites More sharing options...
rberq Posted May 14, 2009 Author Report Share Posted May 14, 2009 Yes, and I have a similar macro that is largely a copy of Paul's. I experimented a little today, with saving the variable to be typed into the clipboard, then explicitly typing CONTROLDOWN - v - CONTROLUP to paste it. That worked better, but was still unreliable. I guess I'll just revert to TEXT TYPE normal typing instead of trying to use the clipboard. It's definitely slower, but way more predictable. Quote Link to comment Share on other sites More sharing options...
monpasdg Posted May 14, 2009 Report Share Posted May 14, 2009 Yes, I wrote and publushed some code a while back that is remarkably similar. Great minds must think alike I was just thinking that this problem may not be macro express but the application its typing into. Macro express "types" Ctrl-v very quickly (less than a few milliseconds) and my guess is the application sees this as Ctrl then v. Whereas a user typing Ctrl-v is holding down the keys for longer periods of time giving the application plenty of time to recognize the command. I am not sure how much the macro is typing out, but if its is a lot of text splitting up the CtrlDown==> V ==> CtrlUp with a very slight delay may allow the program to keep up with sending specific commands. <TEXTTYPE:<CTRLD>><MSD:5><TEXTTYPE:v<CTRLU>> I personally wouldn't use this for 10-20 characters of typing. Quote Link to comment Share on other sites More sharing options...
rberq Posted May 14, 2009 Author Report Share Posted May 14, 2009 You're right, I wouldn't normally use it for 10-20 characters of typing. However, I have 10-20 characters in 10-15 fields across two forms, so the time adds up, especially since there is other overhead involved in looking up the data before typing it into forms, while the customer stands there and fidgits. You may be onto something, though, about it being an application problem and not an ME problem. It's an IE-based application, and that puts another layer of software between the keyboard and Windows. I can't prove it, but I feel like IE responds differently (slower) to keystrokes than most Windows apps. Each field to be typed is preceded by a tab, to get to the field, before data is pasted into the field. Maybe the CTRL portion of CTRL-v is happening before the Tab operation completes. I can try Wait Text Playback or maybe just delay 1/10 second after the Tab and before the pasting of the variable data. Thanks for the idea. Quote Link to comment Share on other sites More sharing options...
terrypin Posted May 15, 2009 Report Share Posted May 15, 2009 Yes, I wrote and publushed some code a while back that is remarkably similar. Was this just for ME3? Do you have ME Pro code too please? -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
paul Posted May 15, 2009 Report Share Posted May 15, 2009 Does the existing code not work in MEP? Quote Link to comment Share on other sites More sharing options...
foray Posted July 15, 2009 Report Share Posted July 15, 2009 Works great, thank you. I have a fix for this. I use it as a function because its rather lengthly and pasting this in every time Ctrl + C makes for a long code. I just call the macro below to do all the clipboard coping and T1 is set to the clipboard contents. First there is a loop to do clipboard copy 5 times to make sure there is something on the clipboard Inside the clipboard copy loop is a loop that makes sure something is on the clipboard If something is on the clipboard the loops are exited and another loop is entered This second loop makes sure that the variable set from the clipboard is exactly what was on the clipboard Since windows uses a buffer for the clipboard i have experienced variables only getting half the clipboard, the second repeat fixes this. 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.