MSSCript control error on MS 10.1.02

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

MSSCript control error on MS 10.1.02

Post by grimeball » Sat Apr 12, 2008 6:26 pm

I am getting the error in the post referenced here:

http://www.mjtnet.com/forum/viewtopic.p ... trol+error

I am using MS 10.1.02.

I have a script I am trying to compile to deploy to a retail store location to make an automated backup of my POS databases, as well as kickoff an automated process to make sales entries into my QUickbooks. If I look at my time as worth about $80/hour, this will save me $1200/week in sweat equity.

I have the script working correctly at home. But when I deploy the exe to the shop locations to the managers via ftp, I am getting the msscript error could not initialize control.

I tried making several script modifications to click 'OK' on the dialog box, but it appears the box is showing before the script can take control.

Once the 'OK' button is hit, the script executes fine. The windows applicaiton is automated and the ftp of the backup is sent to me efficiently.

However, I can't get this to run unattended unless this error regarding control initialization is addressed.

DO I need to register the files in the post referenced above on the target PC? I thought all I had to do was compile an exe and deploy.
Scott Grimes
President, Grimeball Car Care

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 » Sun Apr 13, 2008 4:17 am

There are many situations that can cause a script to run differently between systems. That's not a problem with Macro Scheduler, but just the nature of system differences, race conditions, screen resolutions, speed, other applications opening, unexpected windows from different program configuraions, etc. Sometimes you need to insert some "Wait" values or Window "timeouts", even if not needed on your development system, to allow for the possibility of issues on other systems.

I find it is best not to compile the program until I have run it successfully a number of times on the actual system if possible. It all depends on the macro content, some can be compiled without additional testing, but many may require this extra checking.

We may be able to help you fine tune your script if you can provide a copy here.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

Post by grimeball » Sun Apr 13, 2008 3:32 pm

As I said, the error box is showing before the script takes control. As part of troubleshooting, I did a messagemodal> as the first line to let me know when the compiled script begin executing.

THe sequence of events is I get the information box about the MSSCRIPT control could not be initialized. I click OK on that dialog, then my script starts and I get the messagemodal>

Here's the script, but the problem seems to be happening before the script begins.

On other interesting tidbit, if I have a script that simply ftp's a file, that will run fine. The issue seems to be this script which exercises control over a UI.

While I believe the fix may be something outside of MScheduler, there is obviously a dependency for something to be there when running a compiled script that exercises UI control. Hence, the reason I am seeking support here.

messagemodal>script entered
IfWindowOpen>Login to M.Key,loginMkey
IfWindowOpen>M.key 2.2.6*,skipOpenMkey
ExecuteFile>C:\Program Files\Meineke\MKey\MKEY.exe
WaitWindowOpen>Login to M.Key
Wait>2

label>loginMkey
setfocus>Login to M.Key
Send>%uid%
Press>tab
Send>%pwd%
Press>Enter
Wait>15
goto>continueOnHomeScreen

Press>alt
Press>space
Release>alt
Send>n


Label>skipOpenMkey
Let>result=""
//IfWindowOpen>*[Activity Log]*
FindWindowWithText>Activity Log,1,result
If>result=NOT FOUND,getToHomeScreen

Label>continueOnHomeScreen
Scott Grimes
President, Grimeball Car Care

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Apr 13, 2008 4:00 pm

Seems to me it has to be something wrong with the compiled script. Maybe someone else (MJT?) with could compile the script and see if that exe works for you?

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

It consistently reproduceable for every version of the exe

Post by grimeball » Sun Apr 13, 2008 5:32 pm

I compile.

I've sent about 4 different versions at this point trying to fix it, but I've been able to deduce that the dialog box is showing before the script starts, so I can't automate my way around it unattended.

Not sure if I mentioned it before, but once I click OK, the script executes fine even though it claims it could not initialize the msscript control.
Scott Grimes
President, Grimeball Car Care

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Apr 13, 2008 6:16 pm

Sorry if I wasn't clear, I'm suggesting you have someone else compile the script to rule out any problems with your compiler.

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 14, 2008 2:31 am

I made a compiled version, with minor modifications, has been emailed to Scott. Here is what was compiled:


MessageModal>Sensible Solutions testing
messagemodal>script entered
IfWindowOpen>Login to M.Key,loginMkey
IfWindowOpen>M.key 2.2.6*,skipOpenMkey
ExecuteFile>C:\Program Files\Meineke\MKey\MKEY.exe
WaitWindowOpen>Login to M.Key
Wait>2

label>loginMkey
setfocus>Login to M.Key
Send>%uid%
Press>tab
Send>%pwd%
Press>Enter
Wait>15
goto>continueOnHomeScreen

//Note, the following lines will never run because of preceeding GoTo command.
Press>alt
Press>space
Release>alt
Send>n


Label>skipOpenMkey
Let>result=""
//IfWindowOpen>*[Activity Log]*
FindWindowWithText>Activity Log,1,result
// Note following line will fial, no label named "getToHomeScreen", so I added a label at the end.
If>result=NOT FOUND,getToHomeScreen

Label>continueOnHomeScreen
// The next label was added by Sensible Solutions to prevent error.
Label>getToHomeScreen
MessageModal>Sensible Solutions has finished the script.
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 » Mon Apr 14, 2008 5:10 am

I had to resend the email. I sent the compiled file as an "exe", but should have known better. Just rename the attached file after you open the email.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

Post by grimeball » Tue Apr 15, 2008 1:48 pm

Bob - I never received an email

Not sure why.

scott at grimeball dot com

replace "at" and "dot" with the symbols.
Scott Grimes
President, Grimeball Car Care

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

Post by grimeball » Tue Apr 15, 2008 2:01 pm

Also, can someone answer the question in regards to any requirements on the target PC running an exe without MSSChed.

Since the exe is telling me it couldn't initialize the msscript control, and the post referenced earlier in the thread discusses registering an ocx file name msscript.ocx, does that need to be registered on the target PC?
Scott Grimes
President, Grimeball Car Care

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 15, 2008 2:23 pm

There should be no requirements. The only time this control is required is if the script contains VBScript. At compile time, if a script uses VBScript the required runtimes are packaged into the EXE. At run time these are extracted from the EXE and registered. The majority of PCs these days already have the required files installed anyway, so the EXE does not need to unpack them.

As mentioned, this control is only required if the script contains VBScript.

The script you posted above does not contain VBScript. So I don't see why you'd get this error unless something else is causing it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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 Apr 16, 2008 12:37 am

Hi Scott

I just did another resend......
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

Post by grimeball » Thu Apr 17, 2008 5:49 pm

got it. testing with the shop this afternoon.
Scott Grimes
President, Grimeball Car Care

grimeball
Newbie
Posts: 14
Joined: Sat Apr 12, 2008 6:19 pm
Contact:

Post by grimeball » Fri Apr 18, 2008 6:26 pm

OK...here's the update.

First, the exe Bob sent me gave the same error as the exe's that I compile. Specifically, its an dialog box with a title of 'Information'. The test of the box is "Error initializing MSScript Contol"

When my Dad clicked OK, the script started and I got your 'Sensible Solutions Testing' box. As I said before, after clicking OK, the script works fine and it did here too.

Second, I thought of a workaround approach where I could kick off the script, and do the backup/ftp process it needed to, then put the process to sleep by calculating the number of seconds between the current time, and the next day when I want the script to run. That way, I would have to click OK once, the script could sleep for 23+ hours, and start the next day...but the process would always be running instead of starting/stopping each day.

I used the VB Script commands for datediff, and dateadd to make this work. WHen i sent the exe to the shop, I got an error that the 'vscript runtimes are not properly installed'.

I thought, per Marcus' note from wednesday, that the exe compiled the runtime into the exe to run vbscript. There was a noticeable increase in the filesize of the exe. Without the vbscript commands, the file size was about 645K. WIth the vbscript, it was over 1MB.

Any guidnace on the next steps?
Scott Grimes
President, Grimeball Car Care

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Apr 18, 2008 6:29 pm

Try downloading and installing the VBScript runtimes onto the target machine. Links at: http://www.mjtnet.com/resources.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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