Sign in to follow this  
Followers 0
mrrlg

Oracle and Pausing a script

10 posts in this topic

I am having a difficult time automating an installation of Oracle Patches. Because Auto It spy cannot detect the name of the button on the Oracle Universal Installer, I tried using the mouse and window positions. Since there are several types of machines in the domain with different screen resolutions, relative and absolute coordinates don't seem to work. I am now exploring using a spash text to tell the user which button to click next. Is there a way to pause the script until the left mouse button is clicked, then stop and start again until they have clicked their way through the installation?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the installer always runs full screen, then screen resolutions are only an additional thought. First will be if the installer window stays the same at all resolutions (as opposed to scaling that I will cover later.

ok, just factor in the additional x,y.

First find the resolution, then factor in the change.

640 x 480 resolution (base)

1024x768 well then, the Xadjustment should be (1024-640)/2

1024x768 well then, the Yadjustment should be (768-480)/2

since the installer window would be centered, we just add half the amount of additional pixels to each x,y coord.

ok, how would this work in code?

oldcode:

; default resolution 640x480
mouseclick("left",100,200)

newcode

; default resolution 640x480
$xfactor=(@Desktopwidth-640)/2
$yfactor=(@DesktopHeight-480)/2
mouseclick("left",100+$xfactor,200+$yfactor)

Now for the Scaling, this is easier because all we do is multiply by the ratio. We find the ratio or scale, and multiply by that. Just as you would scale a house, model car, or recipie.

if you had 2 apples and 3 cups of sugar in one recipie, and had to feed twice as many people, the ratio is 2:1 so you need 4 apples and 6 cups of sugar. See the logic? Find the ratio, and multiply it by your calcs.

If it scales (as in stretches) then use this:

; default resolution 640x480
$xfactor=(@Desktopwidth/640)
$yfactor=(@DesktopHeight/480)
mouseclick("left",100*$xfactor,200*$yfactor)

if it is not running full screen, then you should be looking at Opt("MouseCoordMode", 1) ;1=absolute, 0=relative

You would use mouse clicks RELATIVE to the window you want to click, and it would work with all window resolutions.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Some clarification please, the installer did not run at full screen on the original machine I wrote the script on. That screen resolution was 1024 x 768. The installation windows that popped up had window positions of left:192 Top: 144 width: 646 and height: 512. The mouse had an in window position of x:560 and y:483. That didn't seem to work. So I tried the mouse position on desktop of x:752 and y:627 and this script would work for the first window and then die after that. I had eariler tried Opt("MouseCoordMode",1) and that did not seem to make a difference. Here is a portion of the script

AutoitSetOption("WinTitleMatchMode",4)

AutoitSetOption("MouseCoordMode",0)

Run("\\aoofs\oracle\2376472\Disk1\setup.exe")

WinMove("Oracle Universal Installer", 192, 144, 646, 512)

WinWaitActive("Oracle Universal Installer")

MouseClick ("Left", 752,627)

WinMove("Oracle Universal Installer", 192, 144, 646, 512)

WinWaitActive("Oracle Universal Installer")

MouseClick ("Left", 752,627)

WinMove("Oracle Universal Installer", 192, 144, 646, 512)

WinWaitActive("Oracle Universal Installer")

MouseClick ("Left", 752,627)

WinMove("Oracle Universal Installer", 192, 144, 646, 512)

WinWaitActive("Oracle Universal Installer")

MouseClick ("Left", 77,483)

WinMove("Exit", 385, 258, 260, 168)

WinWaitActive("Exit")

MouseClick ("Left", 170,144)

Any ideas where I'm going wrong?

Share this post


Link to post
Share on other sites

Ok, I would have a few questions and some suggestions:

;AutoitSetOption("WinTitleMatchMode",4); no needed for regular window names.
AutoitSetOption("MouseCoordMode",0); if not full screen, this should work great.
Run("\\aoofs\oracle\2376472\Disk1\setup.exe")
;WinMove("Oracle Universal Installer", 192, 144, 646, 512); you shouldn't need any moves of the window.
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)
; you should have some sort of pause, sleep()
; or something so that it doesn't just keep moving the mouse and clicking.
; like waiting for certain text.
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)

WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)

WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 77,483)
WinMove("Exit", 385, 258, 260, 168)
WinWaitActive("Exit")
MouseClick ("Left", 170,144)

My first question is if you use the above code, does it work on the original computer?

Second, if "Oracle Universal Installer" remains active, the mouse is going to move and click all 5 times as fast as it can on the window. Did you want that, or did you want to wait til each page has changed?

Is there any visable text changes when the button is clicked shown on AutoItWindowSpy? if so you could use WinWaitActive("Oracle Universal Installer","text that is shown when I want to click button2")

If you get too frustrated, In the scraps forum there is a new autowriter, it might save you some time for this, and you can figure out x,y coords.

this might help show you what is happening:

;AutoitSetOption("WinTitleMatchMode",4); no needed for regular window names.
AutoitSetOption("MouseCoordMode",0); if not full screen, this should work great.
Run("\\aoofs\oracle\2376472\Disk1\setup.exe")
;WinMove("Oracle Universal Installer", 192, 144, 646, 512); you shouldn't need any moves of the window.
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)
; you should have some sort of pause, sleep()
; or something so that it doesn't just keep moving the mouse and clicking.
; like waiting for certain text.
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)
tooltip("I just clicked mouse here",752,627)
sleep(1000)
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 752,627)
tooltip("I just clicked mouse here part2",752,627)
sleep(1000)
WinWaitActive("Oracle Universal Installer")
MouseClick ("Left", 77,483)
tooltip("I just clicked mouse here part3",77,483)
sleep(1000)
WinMove("Exit", 385, 258, 260, 168)
WinWaitActive("Exit")
MouseClick ("Left", 170,144)
tooltip("I just clicked mouse here part3",170,144)
sleep(1000)

Tooltip works on WinXP, 2000, and newer versions.

also, you can speed up mouse movements with speed:

MouseClick ("Left", 170, 144 ,1, 1); click once, move to that spot very very fast.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

To futher complicate things, once the oracle patch is applied it cannot be re-applied. So I will set up a new machine with autoit spy and walk through the installation. I like your winwaitactive idea as there is one portion of the install where it could take as much as 15 minutes to install the files. So I don't think I can put a pause sleep() statement in there. There is too much difference between P III and P IV computers. I will also try the auto writer and see if it helps.

Thanks

Share this post


Link to post
Share on other sites

Tooltip works on WinXP, 2000, and newer versions.

<{POST_SNAPBACK}>

Tooltip works on anything with something around IE 3.0 or higher. So, basically every system.

Share this post


Link to post
Share on other sites

Also to note, the new version of AutoIt spy now needs to have you choose to use window or client mode, it used to display both screen and window coords at the same time. Make sure to change options to use window or client mode when getting x,y coords.

It can really mess up a script if you have it set wrong.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Using Autorecord on a fresh install of the oracle patch I captured the following information. I then pasted it into the existing script and created an executable. The script did the first two mouse clicks correctly, blew through the next three mouse clicks and then waited until the exit window was active and blew through the next two mouse clicks. I noticed the sleep statement captured by autorecord was the same regardless of how long it actually took to complete that portion of the task. Should I start lengthening the time period for each of those or is there some way that I can identify each instance of the Oracle Universal Installer as a new window? Also, why are mouse clicks identified as MouseDown, MouseUP?

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Disk1","")

If Not WinActive("Disk1","") Then WinActivate("Disk1","")

WinWaitActive("Disk1","")

MouseMove(529,126)

MouseClick("left",529,126,2)

Run("\\aoofs\oracle\2376472\Disk1\setup.exe")

WinWait("Oracle Universal Installer","")

If Not WinActive("Oracle Universal Installer","") Then WinActivate("Oracle Universal Installer","")

WinWaitActive("Oracle Universal Installer","")

MouseMove(566,477)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(561,477)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(55,473)

MouseDown("left")

MouseUp("left")

Sleep(1000)

WinWait("Exit","")

If Not WinActive("Exit","") Then WinActivate("Exit","")

WinWaitActive("Exit","")

MouseMove(170,137)

MouseDown("left")

MouseUp("left")

Sleep(1000)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Do you know that the Oracle Universal Installer can be set up to run unattended using the -silent and -responseFile switches? The -record -destinationFile switches can be used to record an appropriate response file.

Check out http://www.appdeploy.com/packages/detail.asp?id=182

Edited by pacman

Share this post


Link to post
Share on other sites

I am aware of a silent install component, I am using Oracle 8i and there are 305 pages of instructions that accompany this patch. We are part of a larger organization and get very little help from the parent company. They just post these patches and say figure it out for yourself. There is another patch to be applied after this one that does not come with the installer. So I was trying to write these scripts in AutoIt as my users are familar with how it works.

Share this post


Link to post
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
Sign in to follow this  
Followers 0