Network Lag

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Mirdurern
Newbie
Posts: 11
Joined: Mon Sep 27, 2004 5:46 pm

Network Lag

Post by Mirdurern » Tue Oct 12, 2004 4:01 pm

Hello all,

I saw a post a while back about network lag and a way past it. I have done a search but was unable to find it.

Here is the situation, at 6:30am the macro runs fine going out to the network and bring data back. Around 8:30am till about 3:30pm it starts to hang up. I have placed Wait> and WaitReady>0 into the macro but it still only works some of the time. Does any have any ideas on how I could have the macro pause as it get the information from the network and network database?

Thank you
Mike

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 Oct 12, 2004 7:03 pm

Need more information about what you are doing with the script.

There are many other techniques you can use besides Wait> to make a delay.....You can look for existence/removal of a file/folder/phrase/a line in a file, a file size, the date/time stamp of an action, the opening/closing of a file/window, the change of color of a pixel, etc.

RP_WAIT can also be very helpful if you are calling other programs.

Can you provide sample of the code and point out where the delays are happening?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Mirdurern
Newbie
Posts: 11
Joined: Mon Sep 27, 2004 5:46 pm

Post by Mirdurern » Tue Oct 12, 2004 7:44 pm

Here is some of the code that I use.

VBSTART

GetSSN = right(InputBox("Enter Serial Number : "),10)

Dim SQLString

Dim SSN

set MyDB = CreateObject("ADODB.Connection")

MyDB.Open "shellman"

SQLString = "select initcap(fnameupper) fname, initcap(lnameupper) lname from ear e, journal j, person p where e.journalid = j.journalid and j.personid = p.personid and electronicsserno = '" & GetSSN & "'"

set rsCustomers = MyDB.Execute(SQLString)

If Not rsCustomers.EOF then
SSN = rsCustomers.Fields("fname")
SSN = SSN & " " & rsCustomers.Fields("lname")
Else
SSN = "NFound"
End if

MyDB.Close

VBEND
VBEval>SSN,cname
VBEval>GetSSN,name
//The step of going to the database also cause some lag.

If>cname=NFound,NoName
Wait>1.0
WriteLn>C:\logFile.txt,%name%
WriteLn>C:\logFile.txt,%name%-1
WriteLn>C:\logFile.txt,%name%-2
ReadLn>C:\logFile.txt,1,SN
ReadLn>C:\logFile.txt,2,SNA
ReadLn>C:\logFile.txt,3,SNB
Let>listpathtech1=\\jupiter\vol2\SLA\3dImages\idnumber\
IfDirExists>listpathtech1,MainLoop
Goto>Final

//I place this looking for a folder on Jupiter it help to pause the macro a little.

Label>MainLoop
SetFocus>Microsoft Word*
WaitReady>0
Let>path1=\\jupiter\vol2\SLA\3dImages\
Let>path=DataSheetBack.dot
Press CTRL
Send Character/Text>o
Release CTRL
Wait>0.8
WaitReady>0
Send Character/Text>path
//The above paste of the path is one of the area it stops working at or hangs up. I notice this as the day goes on.

WaitReady>0
Press Enter
Press ALT
Send Character/Text>i
Release ALT
Send Character/Text>P
Send Character/Text>F
Wait>0.5
WaitReady>0
Send Character/Text>SN
Send Character/Text>.jpg
Press Enter
WaitReady>0

Thanks agian for the help
Mike

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 Oct 12, 2004 8:22 pm

That was good. If the following comments don't help, can you also send a log file showing the delay on this portion of the script?
Label>MainLoop
SetFocus>Microsoft Word*
WaitReady>0
Let>path1=\\jupiter\vol2\SLA\3dImages\
Let>path=DataSheetBack.dot
Press CTRL
Send Character/Text>o
Release CTRL
Wait>0.8
WaitReady>0
Send Character/Text>path
//The above paste of the path is one of the area it stops working at or hangs up. I notice this as the day goes on.

WaitReady>0
Press Enter
Press ALT
Send Character/Text>i
Release ALT
Send Character/Text>P
Send Character/Text>F
Wait>0.5
WaitReady>0
Send Character/Text>SN
Send Character/Text>.jpg
Press Enter
WaitReady>0
After doing CTL-O, you might want to insert a WaitWindowOpen>Open command, followed by ALT-N to force the focus into the field for the file name. You may also want to put in the entire path and file name vs. just the filename(%path%) in case Word is carrying over the most recent folder location.
-------------------------------------
This may not have an effect on your network delays, but my own personal habits with Macro Scheduler have evolved into using WaitReady>1 before doing any data entry (Send>, Mouse....,Press..., etc.) I just mention it because I see so many WairReady>0 in your script, also just before doing data entry.

Is the Word Document on a local drive or on the network?
What is the default path in Word?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Mirdurern
Newbie
Posts: 11
Joined: Mon Sep 27, 2004 5:46 pm

Post by Mirdurern » Tue Oct 12, 2004 8:39 pm

Hello,
The WaitWindowOpen>Open appears to work but also the network is not being used anymore. I will test it tomorrow morning.

Is the Word Document on a local drive or on the network?
The document is located on the network drive.

What is the default path in Word?
\\jupiter\vol2\SLA\3dImages Clip art
\\jupiter\vol2\SLA\3dImages Template
\\jupiter\vol2\SLA\3dImages Document

Also what is the differents between WaitReady>0 and WaitReady>1 ?

New quesiton, is it possible to make a dialog box with LARGE text exmaple would be like text size 18 or 20? MessageModal>%name% have the %name% appear in text size 18 or 20.


Thanks
Mike

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 Oct 12, 2004 9:56 pm

A few more comments:

If the network is not being used any longer, I would suggest that you change the default paths for Word as necessary.

As a general practice in windows like File, Open... I would strongly suggest entering the complete %path%\%filename% into the field for the filename. This will override any other paths that the program may want to use as a default each time you run your routine.

From the Help section on WaitReady:
WaitReady suspends script execution until the foreground window has finished processing mouse, keyboard, show window, and optionally, paint events. Issue 1 to include paint events, and 0 to exclude paint events. This command can therefore be used to wait until the active application is ready to receive keyboard and mouse events in most situations.
Curious why you used it at all, or why the value=0 if you were unaware of the difference? Was this a modification of another existing code?

Finally, re LARGE text in a dialog box, the answer right now is NO. I know that I have requested similar changes some time ago, but the current version does not have that capability.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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 Oct 12, 2004 10:35 pm

After submitting my last answer, I remembered a process that I have used in the past on other programs. I have not tried this yet with compiled Macro Scheduler files, but here is some information based on earlier experience:

I found that some dialogs in some program are too small, and at times you can't see the whole thing at once. Ideally the dialogs would be re-sizeable, but only the manufacturers can do that.

But there may be something that you can do, right now, to your compiled Macro Scheduler files to fix this. All you need is 5 minutes and a resource editor. Try this one: http://www.users.on.net/johnson/resourcehacker/ if you don't already have one.

Create and test your Macro Scheduler script. Now compile it, for example let's name the file "MyScript.exe"

All you need to do, AFTER making a backup copy of MyScript.exe (and closing it, if it's already open) is:

Open MyScript.exe in your resource editor
Find the dialogs a, b, & c and stretch them as wide as you want them
Move the buttons and resize the edit controls to fit the new width
Save the new MyScript.exe

Now just open the new MyScript.exe and try them out. They aren't re-sizeable, but at least they're bigger! It may also be possible to do somethings with fonts.

This should be able to be used on any exe file, so this should work on a compiled version of a Macro Scheduler script. I will try to use this with a compiled script over the next few days, but perhaps someone else will do it before me and report on results.

Also would need to remember that any changes made with this technique will disappear whenever you make an upgrade. You will have to do the editing again.

Before you try this on any program, it is also important to read licensing information to make sure you are not violating any terms. For example, MJT licensing for Macro Scheduler does not allow any modification to their program file.
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 » Tue Oct 12, 2004 10:44 pm

Hmm. Dunno why you need to do that to resize dialogs. All custom dialogs can be set to any size you like. Message boxes are sizeable. Just drag the edges. Yes, there's nothing that lets you change the text size - apart from the Windows settings, but as for resizing them you can already do this.
MJT Net Support
[email protected]

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 Oct 12, 2004 11:59 pm

I used that as an example of what has been done in other programs. I am suggesting that perhaps fonts may also be changeable with this process. As stated, I haven't looked inside a compiled script to cheek that out yet. And it has been a few years possibly since I used it.

But I was also correct about an earlier request for this as a feature, a little over a year ago. Here is a pointer: http://www.mjtnet.com/forum/viewtopic.p ... ialog+font

Among other requests that were made, you have provided a solution to the Dialog Timout request, maybe this one still has a future chance? How about a Forum Catetory of its own for Enhancement Requests. No need for commitment from MJT, but a good source of feedback about what end users think they would like to see. Can also use Poll features. See example of this on TextPad forum. They use the same Web Forum software from phpBB.
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 » Wed Oct 13, 2004 9:59 am

How about a Forum Catetory of its own for Enhancement Requests
Done.
MJT Net Support
[email protected]

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 » Wed Oct 13, 2004 2:21 pm

WOW! That was fast!.

Will have to start filling it in.

Thanks Marcus.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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