Jump to content

Script just stops running


Recommended Posts

I wrote a script to have MS Project installed. t runs from a cdserver and it worked fine.

I compiled the scritp and tested it again - worked fine again. This was all approx 3-4 weeks ago.

Now when I run the scritp it stops just before it starts copying the files. I checke dthe code and all looks excellent.

;Start Application Installation
Run("\\cdserver\MSPROJECT11\setup.exe")

WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "In the boxes below, type your 25-character Product Key")
$serialproject = "Place code in here"
Send ($serialproject)
Send ("{TAB}")
Send ("{ENTER}")

WinWaitActive ("Microsoft Office Project Professional 2003 Setup","Microsoft cares about your privacy")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Next >", 1994)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "&Next >",  1994, "", 1)

;Accept License agreement
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "End-User License Agreement")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "I &accept the terms in the License Agreement", 298)
ControlCommand ("Microsoft Office Project Professional 2003 Setup", "", 298, "Check", "")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

;Select Custom Installation
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Type of Installation")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Custom Install", 21500)
ControlCommand ("Microsoft Office Project Professional 2003 Setup", "", 21500, "Check", "")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Next >", 1994)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "&Next >",  1994, "", 1)

;Select advanced custom settings
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Advanced Customization")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2011)
Send ("{SPACE}")
Send ("{DOWN 2}")
Send ("{ENTER}")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

;Install the application - HERE THE SCRIPT JUST STOPS !!!!
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

;Installation Compleet
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Microsoft Office Project Professional 2003 Setup has completed successfully")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Finish", 2114)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "&Finish",  2114, "", 1)

MsgBox (64, "Installation Compleet", "The Microsoft Project 2003 installation has completed succesfully", 10)

As seen above I have included the code and the whole installation just stops at the section: ;Install the application - HERE THE SCRIPT JUST STOPS !!!!

But the Install buttun is focused but it does not click it to copy the files over !

What am i doing wrong ?

Link to comment
Share on other sites

just reading a difference in your programming

************* section a

Send ("{TAB}")

Send ("{ENTER}")

WinWaitActive ("Microsoft Office Project Professional 2003 Setup","Microsoft cares about your privacy")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Next >", 1994)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "&Next >", 1994, "", 1)

*****************

this part works correctly, here after sending enter you wait for the active window

but

***************** section b

Send ("{DOWN 2}")

Send ("{ENTER}")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)

*****************

here you dont wait for the active window.....

and

******************* section c

;Install the application - HERE THE SCRIPT JUST STOPS !!!!

WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)

**********************

after section b you then wait for the active window.... and set focus on the same 2008 as section b

hope it helps

8)

NEWHeader1.png

Link to comment
Share on other sites

just reading a difference in your programming

************* section a

Send ("{TAB}")

Send ("{ENTER}")

WinWaitActive ("Microsoft Office Project Professional 2003 Setup","Microsoft cares about your privacy")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "&Next >", 1994)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "&Next >",  1994, "", 1)

*****************

this part works correctly, here after sending enter you wait for the active window

but

***************** section b

Send ("{DOWN 2}")

Send ("{ENTER}")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

*****************

here you dont wait for the active window.....

and

******************* section c

;Install the application - HERE THE SCRIPT JUST STOPS !!!!

WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)

ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

**********************

after section b you then wait for the active window.... and set focus on the same 2008 as section b

hope it helps

8)

<{POST_SNAPBACK}>

Oke forst of all tnx for the reply.

But as you stated in section B

after each click I always specify a wait command for the window to appear so:

After the initial setup and section A we get a whole bunch of standard windows where you click on ok or next. Then you get to the listview where you specify which items to install:

It starts with a wait and then I choose to install all applications: -->

;Select advanced custom settings
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Advanced Customization")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2011)
Send ("{SPACE}")
Send ("{DOWN 2}")
Send ("{ENTER}")

ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "",  2008, "", 1)

and then it wait again for the next window to appear and then focus on the button and clicks it ones

;Install the application - HERE THE SCRIPT JUST STOPS !!!!
WinWaitActive ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)

The script runs good untill it is at the aboce code section - it won't go any further.

So what I did is created a seperate script with only:

;Install the application
WinActivate ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)

So this time I just activate the window and then it goes... so why will it not go when the windows appear and will it goes if I create a seperate windows activate script

SO I do not understand it anymore :-(

Link to comment
Share on other sites

  • Moderators

Did you try a an "If" statement?

If WinExist("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications") Then
WinActivate ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)
Else
WinWaitActivate ("Microsoft Office Project Professional 2003 Setup", "Install the following Microsoft Office 2003 applications")
ControlFocus ("Microsoft Office Project Professional 2003 Setup", "", 2008)
ControlClick ("Microsoft Office Project Professional 2003 Setup", "", 2008, "", 1)
Endif

Also you have a typo:

;Installation Compleet

MsgBox (64, "Installation Compleet", "The Microsoft Project 2003 installation has completed succesfully", 10)

Compleet = Complete

Hope it helps

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I can't see anything obviously wrong with your code but I'd like to offer a tip: your code can be made more readable, more compact and less error-prone if you add

local const $title = "Microsoft Office Project Professional 2003 Setup"

to the beginning, and then rewrite your subsequent lines to use $title instead of "Microsoft Office Project Professional 2003 Setup". :)

Regards,

Alex Peters

Link to comment
Share on other sites

Hi,

Why not use the tools from MS to make an "silent" installation ?

Don't blame me but sometimes that's easier than making an complete autoit script.

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...