Jump to content
Macro Express Forums

Recommended Posts

I've tried several times to set up a macro (via CAPTURE) to copy selected text from WORD, switch back to word perfect, and paste it there. I use alt-tab to switch from WORD to WP. However, when I execute the macro, as soon as the macro presses alt-tab to switch to WP to paste, I get:

 

"Paste command failed because the copy and paste areas are different shapes."

 

What causes this, and what can I do to correct it?

Link to comment
Share on other sites

I reccomend first you give up on the capture as you will want to use the Windows Activate commands instead of Alt+Tab. Capture is fine for a series mouse or keyboard events in one application or just to get started but honestly you want to get familiar with using the script editor.

 

There are clipboard commands in MEP. Depending on your application they may work better than CTRL+C, CTRL+V.

 

This is not an MEP error. More likely it's an error from WP. I don't know about WP as it's been a coon's age since I've seen it but I usually see this error in Excel when the destination worksheet has cells selected already. EG the source has 3 cells and in the destination you have 2 cells selected and it doesn't know what to do with it. But in most text editors if one has a selection in the destination application the pasted text simply overwrites it. I can't fathom how you could get this error in WP unless we're talking about tables. I suggest you run the macro and let it fail and then manually go to WP and try pasting again to see if you get the same problem.

 

Finally you might want to consider a little timing delays for events like activating a different Window. Each machine is different but I often find that 200mS is enough. But you can always start with a larger value and later decrease the amount with experimentation.

 

I can't find that error anywhere online regarding WP. Are you certain you're not switching to Excel?

Link to comment
Share on other sites

(Title of these posts should state "paste command" not "past command."

 

 

Thanks for the reply. I've responded to your post below between the ======= lines:

_________________________________________________________________________________________________________

I reccomend first you give up on the capture as you will want to use the Windows Activate commands instead of Alt+Tab. Capture is fine for a series mouse or keyboard events in one application or just to get started but honestly you want to get familiar with using the script editor.

==============================================================================================================

Actually, I'm fairly familiar with the script editor, and have used it. In fact, I once used it to build a macro...then captured some other actions...and tried to paste it into the script editor after I'd set up the commands. It didn't work, though I don't know why yet. I only get a little practice at a time with the program, which makes it hard to learn in depth. How can I insert alt-tab or its equivalent into a macro via the script editor?

==============================================================================================================

 

There are clipboard commands in MEP. Depending on your application they may work better than CTRL+C, CTRL+V.

 

==============================================================================================================

control/c and control/v work ok...it's just switching between 2 open programs that messes up. Actually, I already have the task automated via a freebie macro program (tiny task, I think)...and it works just fine switching between word and wordperfect.

==============================================================================================================

 

is not an MEP error. More likely it's an error from WP.

==============================================================================================================

Actually, the macro bombs before wp loads. Also, I mistakenly referred to the other program as WORD. Actually, it is WordPad.

 

=============================================================================================================

 

 

 

 

I don't know about WP as it's been a coon's age since I've seen it but I usually see this error in Excel when the destination worksheet has cells selected already. EG the source has 3 cells and in the destination you have 2 cells selected and it doesn't know what to do with it. But in most text editors if one has a selection in the destination application the pasted text simply overwrites it. I can't fathom how you could get this error in WP unless we're talking about tables. I suggest you run the macro and let it fail and then manually go to WP and try pasting again to see if you get the same problem.

 

==============================================================================================================

I've already done that. It works just fine. It just won't do its thing via the macro.

==============================================================================================================

 

Finally you might want to consider a little timing delays for events like activating a different Window. Each machine is different but I often find that 200mS is enough. But you can always start with a larger value and later decrease the amount with experimentation

==============================================================================================================.

Ok, I'll give that a try.

==============================================================================================================

 

I can't find that error anywhere online regarding WP. Are you certain you're not switching to Excel?

 

==============================================================================================================This

Absolutely. I never have used Excel. I don't know why, but I've never gotten into spreadsheets. I do word processing and light-duty databases.

==============================================================================================================This

Link to comment
Share on other sites

How can I insert alt-tab or its equivalent into a macro via the script editor?
Text Type command. But hear me now. Do not use Alt+Tab. It's a bad practice that will blow up on you one day. Instead use the Windows Activate command.

 

control/c and control/v work ok.
I believe you should use the MEP clipboard commands instead. My rule is use them until they don't work or there's a performance issue. There are tons of posts here you can find where applications once in 100 times will get nappy and the delay will kill your macro.

 

Actually, the macro bombs before wp loads
You need to look at the Windows/Program Activate/Launch commands. Add timing to wait for the window to load then a second or so more than that to be safe.

 

I've already done that. It works just fine. It just won't do its thing via the macro.
It's probably executing too quickly.
Link to comment
Share on other sites

Selecting text via mouse actions is iffy when automating via macros. It is inherently unreliable. Perhaps this is the reason, or one of the reasons, your script isn't working.

 

Try performing the selection process by keyboard. For example, in most word processors and text editors, this sequence of keystrokes selects the current paragraph. (This sequence may not work if the current paragraph consists only of a carriage return, but I find it reliable for paragraphs that consist of one or more printed characters.)

 

<END> // Go to end of current line

<CONTROL><UP ARROW> // Go to start of paragraph

<SHIFT><CONTROL><DOWN ARROW> // Select to end of paragraph

 

It's more reliable to select text in MS-Word than in any other program that I know. For example, this sequence selects the current word:

 

<F8><F8>

 

This selects the entire sentence:

 

<F8><F8><F8>

 

This selects the entire paragraph:

 

<F8><F8><F8><F8>

Link to comment
Share on other sites

Using the command editor, I can get some things done...but the mouse work can't be done w/o capture.

Yes it can. Use the Mouse Locator utility. I do it all the time.
Link to comment
Share on other sites

Dunno why MEP cannot do alt tab. I'm still using TINYTASK to do just that. It copies to memory...alt tabs...and copies to wordperfect. Totally reliable. So why don't I just use tinytask? Actually, I am, by necessity..but would like to consolidate all macros to MEP. Please, whomever does programming for MEP....please...fix it so it can use alt tab reliably. With it...I can turn on the recorder, record the task, turn off the recorder...and store it to a key...saving hours of programming, debugging, and climbing the learning curve. Oh for the susperkey days.

Link to comment
Share on other sites

Macro Express will type <ALT><TAB> reliably. The issue is that Windows is sometimes unpredictable about the order of the programs. If TinyTask works in your macro I don't see why Macro Express won't. Did you try tying <ALT><TAB> with Macro Express?

Link to comment
Share on other sites

I tried posting this in another note, but the system wouldn't allow me to post at all. I emailed sysops, but got no reply. I have no idea why it's allowing me to post now, but wouldn't for the past several days. It still won't let me post in the MEP section main screen. I suppose I'd better strike while the iron's hot, and post here.

 

I know alt/tab has its disadvantages, but as long as I have only 2 programs running, and make sure that's the case each time I run the macro, it should work fine. Problem is, when I use CAPTURE to create a macro, and the ONLY command in the macro is alt/tab, the following is what I get when I look at it via the script editor:

====================================================================================

 

<MACRO PLAYBACK SPEED Speed='1"/>

 

<MOUSE MOVE Option ="\x01" X="195" _PROMPT="0x000A" />

=================================================================================

 

So...where's alt/tab??????? I never even TOUCHED the mouse, so why did I get a "MOUSE MOVE"?

Link to comment
Share on other sites

I don't use the recorder but I tried it just now and I see what you mean. The recorder is not recording ALT+TAB. You should make a bug report to ISS on this. See the forum sticky if you don't know where. But for the mean time use the Script Editor and the Text Type command to record it yourself.

 

But again it's best you not use ALT+TAB. Use Windows Activation (Where have I heard this before? ;)

 

Even the slightest jiggle of 1 pixel can cause a mouse move event to get captured. Unplug or remove the batteries from your mouse and try again. If it's still appearing to move them you might have some adware in your system doing things. Or a remote user.

Link to comment
Share on other sites

Cory..thanks for the reply. I know I can use activate, but the problem is...I don't have time to climb the steep learning curve of macro programming, which is why I need to use the capture capacity. It doesn't matter to me that it produces a lot of code...just that it works. I used to use superkey for this kind of stuff...until DOS died, then I used the one from "American Systems," but they dropped out of the macro business when win7 came along.

 

When I have hours to pour into this, I think I'm going to have to develop the task I want done in stages, so I can figure out where in the script the alt/tab needs to go, and insert it manually where it's needed. As it is, It's very difficult to find out what's going on in each line of code unless you're a coder...and I'm not. It would help matters if MEP would have an option to color code certain commands in the script to make them easier to spot...but they don't.

 

Unplugging the mouse controller might make MEP capture an alt/tab. I'll try that 2c if it works.

 

Meanwhile, why do you suppose the system won't let me post outside of this thread?

Link to comment
Share on other sites

I don't have time to climb the steep learning curve of macro programming, which is why I need to use the capture capacity.

 

There is a learning curve to getting the hang of macro scripting, but one of the good things about Macro Express is that it eases the process because you do not have to type the commands. The task you want to do would be more complex in, say, AutoHotkey.

 

I cannot think of a reason why Alt Tab isn't working for you. It may be true that you cannot capture the keystroke (which if true I would say is a bug), but using the Scripting Editor to type <ALT><TAB> is straightforward. (And if it doesn't work, there may be an explanation. For example, make sure there is no space between <ALT> and <TAB>. <ALT><TAB> is not the same as <ALT> <TAB>.

Link to comment
Share on other sites

After I logged out, I decided on another route,which was successful. I broke the task into 3 subtasks...then used capture to code each one. I then manually inserted the alt/tab at the end of each subtask. Then, I cut and pasted all 3 together and it worked.

 

Still...this site won't let me post outside of this thread.

Link to comment
Share on other sites

I found out why your captured macro has a Mouse Move command. In order for a captured macro to work in all cases, it needs to know where the mouse was when the macro is captured. Macro Express moves the mouse to the original location near the top of the captured macro.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...