Im serious this is part of my script.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Im serious this is part of my script.

Post by pantsmonkey » Mon Apr 18, 2005 6:59 am

Im going to edit out all of my previous rant. It was a long 30 odd hours....

Sorry if I offended anyone with a sleep deprived onset of "PASTE DOESNT WORK" I digress :)



CapsOff
Let>NumTimesToLoop=64
Let>Counter=0
Let>X=0

Label>StartOfLoop

setfocus>PPHome*
WaitWindowOpen>PPHome*
wait>.1
press down * 1
press enter
WaitWindowOpen>Broadband*
press down * 39
press shift
wait>.1
press down * 104
press ctrl
Send>c
wait>.1
release shift
release ctrl
wait>.1
press alt
press f4
wait>.1
release alt
setfocus>microsoft excel*
WaitWindowOpen>microsoft excel*
press ctrl
send>v
release ctrl
press alt
send>j
wait>.1
release alt
wait>.1

Add>Counter,1
Add>X,1
If>Counter=NumTimesToLoop,FinishLoop
Goto>StartOfLoop
Label>FinishLoop


The above is code I use to open a series of .txt documents copy specific contents and then paste said contents into excel.

From there after a paste into sheet 1 MS calls a keypress macro in housed in Excel that splits everything from page one to page 2.

(Its to change the orientation of the text from horizontal to vertical, re-arrange last names to the front and concatenate address fields into a standard format for importing into an access database.

I have a couple of problems.

1. Im sure my code up there is some form of blasphamy I dont care I want to have some sleep sometime this week its been one of those weeks at work and its tuesday! I know it works and tidy it up as I go but I do have to copy the very first order file because the loop presses down once so it skips the first order :)

2. I copy a specific chunk of text from the excel document, certain txt files have added a 2nd or even 3rd line of text for "special comments field".
Image

So if there is content of anykind on line 60 of the text document. (when the order has fewer comments it fits on the line above but some people waffle on for ages to the lines below.)

I need the macro to rename the file to "0000X CHECK.txt" Where X is a variable that increases based on the number of documents opened with content on line 60 + 1.

IF there was some way that that macro scheduler can cut any extra comments back onto the correct line making sure that the next field Current Internet: a blank line down so the paste into excel doesnt go into the incorrect columns.

Im Dyslexic and havent had to do this stuff for years, Im also trying to do similar antics with Access webpages and 10 others things so I never end up getting past the COBBLER stage with any system.

Thank god I have a 2nd Job.

Cheers
Last edited by pantsmonkey on Tue Apr 19, 2005 12:18 pm, edited 1 time in total.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Apr 18, 2005 7:28 am

What if you remove the last Press CTRL? Just do Shift-End.

If that does not work, what program are you trying to do this in. They do not always use the same "standard" keystrokes.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Apr 18, 2005 7:57 am

You need to add Release CTRL and Release Shift:

press shift
Wait>0.01
press ctrl
Wait>0.01
press end
Release ctrl
Release shift
MJT Net Support
[email protected]

pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Post by pantsmonkey » Tue Apr 19, 2005 12:53 am

support wrote:You need to add Release CTRL and Release Shift:

press shift
Wait>0.01
press ctrl
Wait>0.01
press end
Release ctrl
Release shift

CapsOff
setfocus>Home*
Wait>0.01
press home
Wait>0.01
press enter
Wait>1.00
MouseMove>6,564
lclick
Wait>0.10
press shift
Wait>0.01
press ctrl
Wait>0.01
press end
Release ctrl
Release shift


Above is my exact script it does not actually select text in Macro Scheduler 6.0 (the version my work has purchased)

It does work in 7.3 eval version though.

Does this mean we cannot use this scripting for MS version 6.0 ?

Is there a fix for older versions ?

CHeers

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Apr 19, 2005 1:20 am

I could be wrong, but I don't think that the example you are showing uses any of the newer features.
You should be able to use those commands to select text with version 6.

1. Have you removed all trailing spaces?

2. Are the mouse coordinates correct?
Should you be using MouseMoveRel instead?
Can you use Tab/Shift-Tab or other keystrokes to get cursor to correct position before press Shift key?

3. What does the log show for activity?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Post by pantsmonkey » Tue Apr 19, 2005 1:48 am

Bob Hansen wrote:I could be wrong, but I don't think that the example you are showing uses any of the newer features.
You should be able to use those commands to select text with version 6.

1. Have you removed all trailing spaces?

2. Are the mouse coordinates correct?
Should you be using MouseMoveRel instead?
Can you use Tab/Shift-Tab or other keystrokes to get cursor to correct position before press Shift key?

3. What does the log show for activity?

Have check all of those things.

Putting a 6.0 Script into 7.3 checks the trailing spaces its not that.
Mouse Co -Ords are fine it simply clicks at the place I want to start scraping data from.

I will put a loop in so that the down arror is pressed enough times to get to the correct line and try without the mousemove.

I think however the problem is relating to the multiple keypresses simultainiously in ver 6.0.

LOG OUTPUT VER 6.0

19/04/2005 11:44:32:344 - Started Macro : wert
19/04/2005 11:44:32:344 - CapsOff
19/04/2005 11:44:32:364 - setfocus>Home*
19/04/2005 11:44:32:364 -
19/04/2005 11:44:32:374 - Wait>0.01
19/04/2005 11:44:32:374 - press home
19/04/2005 11:44:32:384 - Wait>0.01
19/04/2005 11:44:32:384 - press enter
19/04/2005 11:44:33:386 - Wait>1.00
19/04/2005 11:44:33:386 - MouseMove>6,564
19/04/2005 11:44:33:386 - lclick
19/04/2005 11:44:33:486 - Wait>0.10
19/04/2005 11:44:33:486 - press shift
19/04/2005 11:44:33:536 - Wait>0.05
19/04/2005 11:44:33:536 - press ctrl
19/04/2005 11:44:33:586 - Wait>0.05
19/04/2005 11:44:33:596 - press end
19/04/2005 11:44:33:646 - Wait>0.05
19/04/2005 11:44:33:646 - Release ctrl
19/04/2005 11:44:33:646 - Release shift
19/04/2005 11:44:33:656 - Wait>0.01
19/04/2005 11:44:33:656 - press ctrl
19/04/2005 11:44:33:656 - rem press
19/04/2005 11:44:33:656 - Finished Macro : wert


cheers

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Apr 19, 2005 4:23 am

Hmmm, and once again, what program are you trying to use this with?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Post by pantsmonkey » Tue Apr 19, 2005 5:22 am

Excel 2003

It would seem Macro Schedular and Excel 2003 dont play nice (making it painfully annoying)

I know the combination of using MS 6.0 and MS 7.3 EVAL is confusing me partially MS 6.0 is incapable of copying information I read in a help file somewhere about seting keylegacy to 1.

I have no idea how to do that.

It would appear that macro scheduler will not interface with Excel 2003 fully.

I cannot use

Press Ctrl
send>v


To paste it will not work in excel 2003 i have tried setting up additional macros to call a specifc paste macro.

I have recorded me pressing the ctrl and v buttons and tryed to replay the macro NO DICE.

It wont work.

My fix for this initial pasting error into excel 2003 (its not so much a past error as MS 7.3 Eval refusing to actual issue the commands) The constant NAG yellow popup doesnt help much either.

I subsitituted
Press CTRL
send> v

for

press alt
send>e
send>p

That works ???

However I need macro scheduler to then press CTRL then F

This is the excel shortcut for my split up the pasted document in sheet one and organise it onto sheet 2 macro.

I got around this by adding a custom macro butt and then using

mousemove x,y
lclick

refuses to actually click on the smiley face icon in excel.


Im not going insane here this program just flat out refuses to issue the most simple of commands to excel.

Ive spent the last about 25 plus hours trying to get Ctrl V paste.


Im losing my mind, And the only way out of this hole Ive been diging myself with macro schedular is to get this to work.

Its just Copy and Paste why is it so difficult ?

It appears the issue isnt my insanity its just not going to work.

I will wait for the next release that allows this SK_Legacy business.

I wish I knew that before sunday I would have just manually processed all of the orders.

Which Im about to start now.


Thanks for you help though. This program has real promise. Unfortunatly the work I was trying to demonstaight its potential benifits to the company i work for with is going to be a few days late :)

Thanks Again.

pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Post by pantsmonkey » Tue Apr 19, 2005 5:48 am

Is there anyway I can set the entire clipboard contents as a variable name and then use.

Send Character/Text>%variablename%

Im not sure how to go about this ?


It still doesnt help my issue with the inability to press CTRL + F withing excel 2003.



I dont understand why such a simple command wont work could someone who does give me a laymans term explanation of why pressing ctrl v with macro scheduler doesnt actually do anything ?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Apr 19, 2005 8:10 am

We've never had any problems whatsoever with automating Excel 2003 with Macro Scheduler. My guess is your keyboard focus is wrong - either you're not focusing Excel or the wrong part of Excel has the focus.

However, if you're reading/writing data from/to Excel I would recommend using DDE or VBScript. Much easier and more reliable than simulating keystrokes. Plenty of examples on this forum:

http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
MJT Net Support
[email protected]

pantsmonkey
Newbie
Posts: 9
Joined: Sat Apr 16, 2005 11:03 am

Post by pantsmonkey » Tue Apr 19, 2005 8:33 am

support wrote:We've never had any problems whatsoever with automating Excel 2003 with Macro Scheduler. My guess is your keyboard focus is wrong - either you're not focusing Excel or the wrong part of Excel has the focus.

However, if you're reading/writing data from/to Excel I would recommend using DDE or VBScript. Much easier and more reliable than simulating keystrokes. Plenty of examples on this forum:

http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
Yeh il have a looksie Im not exactly sure what it is one of the I.T staff at work spent 3 seconds at my desk explained why and then proceeded to discuss the "Multiple ways to skin a cat theory"

So I decided to just figure out the distance between the files in my page scrollable folder full of .txt orders and will loop it to the counter movements for the number of files.

That should work if I can figure out how to to do nested loops again.

Image

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts