Sign in to follow this  
Followers 0
Athlon1000

Realvnc Install Script Problem

18 posts in this topic

Hi

I have a rather annoying problem with my installation script for RealVNC Server and Viewer.

I'm using AutoIt 3.1.1 and the latest beta (autoit-v3.1.1.114-beta-Setup.exe) along with RealVNC (vnc-4_1_1-x86_win32.exe) which is a InnoSetup installation file.

The script works great until it reaches this window:

Posted Image

This is the code for that window:

WinWaitActive("Setup - VNC", "Setup is now ready to begin installing VNC on your computer.", 3000)

Send("!i")

And here is a screenshot of the window info:

Posted Image

I'm using the same technique for my whole script, and as I said it works like a charm up until that window.

If you need it I can post my whole installation script.

What the heck could be wrong here ?

Please heeeeelp :)

Share this post


Link to post
Share on other sites



The script would be nice... but... in the mean time, for that window you could do: WinWaitActive('classname=TWizardForm', 'Setup is now ready', 3000) ... P.S. do you know you are waiting 3000 seconds for it to show up?

$WinWaitOPT = Opt('WinTitleMatchMode', 4); setting up for classname=
$WinChildOPT = Opt('WinSearchChildren', 1); setting up to read child windows
WinWaitActive('classname=TWizardForm', 'Setup is now ready', 3000)
Opt('WinSearchChildren', $WinChildOPT); resetting to original status
Opt('WinTitleMatchMode', $WinWaitOPT); resetting to original status


[center]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.[/center]

Share this post


Link to post
Share on other sites

Hi,

maybe you also find some interesting things, here http://www.msfn.org/board/index.php?showforum=80

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The script would be nice... but... in the mean time, for that window you could do: WinWaitActive('classname=TWizardForm', 'Setup is now ready', 3000) ... P.S. do you know you are waiting 3000 seconds for it to show up?

$WinWaitOPT = Opt('WinTitleMatchMode', 4); setting up for classname=
$WinChildOPT = Opt('WinSearchChildren', 1); setting up to read child windows
WinWaitActive('classname=TWizardForm', 'Setup is now ready', 3000)
Opt('WinSearchChildren', $WinChildOPT); resetting to original status
Opt('WinTitleMatchMode', $WinWaitOPT); resetting to original status

UPDATE: SmOke_N: Tried your code without any luck. Must be something funny with that one window.

Ok, I'm kinda new to this stuff so I'm using very basic stuff at this point.

3000 seconds, wow. I thought it was miliseconds =)

Here's the code:

Run("data.exe")

WinWaitActive("Setup - VNC", "Welcome to the VNC Setup Wizard")

Send("!n")

WinWaitActive("Setup - VNC", "License Agreement")

Send("!a")

Send("!n")

WinWaitActive("Setup - VNC", "Select Destination Location")

Send("!n")

WinWaitActive("Setup - VNC", "Select Components")

Send("{TAB}")

Send("{SPACE}")

Send("{SPACE}")

Send("{DOWN}")

Send("{SPACE}")

Send("!n")

WinWaitActive("Setup - VNC", "Select Start Menu Folder")

Send("!n")

WinWaitActive("Setup - VNC", "Select Additional Tasks")

Send("!n")

WinWaitActive("Setup - VNC", "Setup is now ready to begin installing VNC on your computer.", 3)

Send("!i")

WinWaitActive("VNC Server Properties (Service-Mode)", 3)

Send("{TAB}")

Send("{ENTER}")

WinWaitActive("VNC Server Password")

Send("123456")

Send("{TAB}")

Send("123456")

Send("{TAB}")

Send("{ENTER}")

WinWaitActive("VNC Server Properties (Service-Mode)", 3)

Send("{ENTER}")

Send("{TAB}")

Send("{TAB}")

WinWaitActive("VNC Free Edition Binary Distribution for Windows platforms")

Send("!n")

WinWaitActive("Setup has finished installing VNC on your computer.")

Send("{ENTER}")

Edited by Athlon1000

Share this post


Link to post
Share on other sites

Have a link where I can download it at? I'll see what I can do before the nyquil hits me :)


[center]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.[/center]

Share this post


Link to post
Share on other sites

Have a link where I can download it at? I'll see what I can do before the nyquil hits me :)

http://www.realvnc.com/download.html


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Real VNC 3.3

Install Switch: /silent /sp-

Maybe it will work for newer versions too ? Instead of doing all this work in autoit try starting it with switch and check out if it installs correctly.


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Real VNC 3.3

Install Switch: /silent /sp-

Maybe it will work for newer versions too ? Instead of doing all this work in autoit try starting it with switch and check out if it installs correctly.

Update: found the registry keys

That works fine, but I need to automate the config process also.

Do you, or anyone, who how to export the RealVNC Server settings (password, etc.) from the registry as a .reg file ?

This way I can tell autoit to import the regfile after the installation.

But still, something must be very wrong since autoit cannot install realvnc.

Edited by Athlon1000

Share this post


Link to post
Share on other sites

I was going to suggest a silent install also, but I noticed that they were setting a password....

I saw where you were hanging up, and it wasn't where you said specifically, it was the call before.... After looking at this, I couldn't tell which install you were trying to do, so I made it do both:

Local $Class = 'classname=TWizardForm'
$OptWinTitle = Opt('WinTitleMatchMode', 4)
$OptSearchChild = Opt('WinSearchChildren', 1)
Run('vnc-4_1_1-x86_win32.exe')
;1st Window (Welcome)
_DoSleepTenIsvisible($Class, '&Next >', 'TButton1', 1)
ControlClick($Class, '&Next >', 'TButton1')
Sleep(3000)
;2nd Window Select Radio (License Agreement Radio)
_DoSleepTenIsvisible($Class, 'I &accept the agreement', 'TRadioButton1', '2a')
ControlCommand($Class, 'I &accept the agreement', 'TRadioButton1', 'Check', '')
Sleep(3000)
;2nd Window After Radio Selected (License Agreement Next)
_DoSleepTenIsvisible($Class, '&Next >', 'TButton2', '2b')
ControlClick($Class, '&Next >', 'TButton2')
Sleep(3000)
;3rd Window (Select Destination)
_DoSleepTenIsvisible($Class, '&Next >', 'TButton3', 3)
ControlClick($Class, '&Next >', 'TButton3')
Sleep(3000)
;4th Window (Custom components)
_DoSleepTenIsvisible($Class, '&Next >', 'TButton3', 4)
$OPTSendKeyDelay = Opt('SendKeyDelay', 50)
ControlSend($Class, '', 'TNewCheckListBox1', '{SPACE 2}{DOWN}{SPACE}')
Opt('SendKeyDelay', $OPTSendKeyDelay)
ControlClick($Class, '&Next >', 'TButton3')
If WinExists('Components Exist') Then
    ControlClick('Components Exist', '&Yes', 'Button1')
EndIf
;5th Window (Start menu)
_DoSleepTenIsvisible($Class, '&Next >', 'TButton4', 5)
ControlClick($Class, '&Next >', 'TButton4')
Sleep(3000)
;From here there are 2 different types of instalations
;I couldn't tell what you wanted to do, because one way your doing it (windows you were activating) says to don't install
;And the other way (windows you were activating) said to install the VNC stuff
If Not ControlCommand($Class, 'Ready to Install', 'TNewStaticText1', 'IsVisible', '') Then
;6th Window (Additional Task)
    _DoSleepTenIsvisible($Class, '&Next >', 'TButton4', 6)
    ControlClick($Class, '&Next >', 'TButton4')
    Sleep(3000)
;7th Window (Install)
    _DoSleepTenIsvisible($Class, '&Install', 'TButton4', 7)
    ControlClick($Class, '&Install', 'TButton4')
    Sleep(3000)
;8th Window (Authentication)
    _DoSleepTenIsvisible('VNC Server Properties (Service-Mode)', 'Configure', 'Button3', 8)
    ControlClick('VNC Server Properties (Service-Mode)', 'Configure', 'Button3')
;9th Window (Set Password)
    _DoSleepTenIsvisible('VNC Server Password', 'OK', 'Button1', 9)
    ControlSetText('VNC Server Password', '', 'Edit1', '123456')
    ControlSetText('VNC Server Password', '', 'Edit2', '123456')
    Sleep(5000)
    ControlClick('VNC Server Password', 'OK', 'Button1')
    Sleep(3000)
    _DoSleepTenIsvisible('VNC Server Properties (Service-Mode)', 'Configure', 'Button3', 10)
    ControlClick('VNC Server Properties (Service-Mode)', 'OK', 'Button9')
    Sleep(3000)
    _DoSleepTenIsvisible($Class, '&Next >', 'TButton4', 11)
    ControlClick($Class, '&Next >', 'TButton4')
    Sleep(3000)
    _DoSleepTenIsvisible($Class, '&Finish', 'TButton4', 12)
    ControlClick($Class, '&Finish', 'TButton4')
    Sleep(3000)
Else
    _DoSleepTenIsvisible($Class, '&Install', 'TButton4', '6b Install')
    ControlClick($Class, '&Install', 'TButton4')
    Sleep(3000)
    _DoSleepTenIsvisible($Class, '&Next >', 'TButton4', '7b Next Information')
    ControlClick($Class, '&Next >', 'TButton4')
    Sleep(3000)
    _DoSleepTenIsvisible($Class, '&Finish', 'TButton4', '7b Finished')
    ControlClick($Class, '&Finish', 'TButton4')
    Sleep(3000)
EndIf
Opt('WinTitleMatchMode', $OptWinTitle)
Opt('WinSearchChildren', $OptSearchChild)

Func _DoSleepTenIsvisible($b_Hwnd, $s_Text, $s_ClassNameNN, $iv_WinNum = '')
    $Do_Timer = TimerInit()
    $ReturnCode = ''
    Do
        Sleep(10)
    If ControlCommand($b_Hwnd, $s_Text, $s_ClassNameNN, 'IsVisible', '') Then $ReturnCode = 1
    If TimerDiff($Do_Timer) / 1000 >= 3 Then $ReturnCode = 0
    Until ControlCommand($b_Hwnd, $s_Text, $s_ClassNameNN, 'IsVisible', '') Or TimerDiff($Do_Timer) / 1000 >= 3;<< Wait 3 seconds for window
    If $ReturnCode = 0 Then 
        MsgBox(0, 'Error', 'Timed Out on window: ' & $iv_WinNum)
        Exit
    EndIf
EndFunc
You can remove the sleeps(), that was just to show you what it was doing, and you can remove the comments, that was what I was keeping track with.

I'm NyQuiled up, so I'm not even 100% sure this works...


[center]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.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Sleep(10)

If ControlCommand($b_Hwnd, $s_Text, $s_ClassNameNN, 'IsVisible', '') Then $ReturnCode = 1

If TimerDiff($Do_Timer) / 1000 >= 3 Then $ReturnCode = 0

Until ControlCommand($b_Hwnd, $s_Text, $s_ClassNameNN, 'IsVisible', '') Or TimerDiff($Do_Timer) / 1000 >= 3;<< Wait 3 seconds for window

If $ReturnCode = 0 Then

MsgBox(0, 'Error', 'Timed Out on window: ' & $iv_WinNum)

Exit

EndIf

EndFunc

I'm NyQuiled up, so I'm not even 100% sure this works...

Well, that didn't work =)

How can I tell autoit to import a .reg file to the registry ?

Run didn't work :)

UPDATE: Got it to work finally. After about 5000 lines of code (at lest it felt like that) I ended up with this, which managed to just what I wanted to do:

Run("data.exe /silent /sp-")

sleep(5000)

Run("REGEDIT /S settings.reg")

Man that was hard to achieve :mellow:

Thanks a bunch for all the help, I've managed to learn a lot about autoit during this my first project.

Edited by Athlon1000

Share this post


Link to post
Share on other sites

The install worked on mine.


[center]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.[/center]

Share this post


Link to post
Share on other sites

The install worked on mine.

So much work :)) Try this:

For RealVNC 4 "Service mode"

Export your actual seetings into .reg (and you import this new for re-set RealVNC) form [HKEY_LOCAL_MACHINE\SOFTWARE\RealVNC\WinVNC4]

and for "Application mode" export from [HKEY_CURRENT_USER\SOFTWARE\RealVNC\WinVNC4]

Your reg will contain password encrypted and settings like this :

"Password"=hex:2c,f2,81,e3,b1,49,e1,d7

"PortNumber"=dword:00000016

"RemoveWallpaper"=dword:00000001

"RemovePattern"=dword:00000001

"DisableEffects"=dword:00000001


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

...This way I can tell autoit to import the regfile after the installation...

I've installed this many times and I write to the registry first... then make the install and I'm done. The "listening service" starts and the config options are not able to be changed by right-clicking on the system tray icon. Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I've installed this many times and I write to the registry first... then make the install and I'm done. The "listening service" starts and the config options are not able to be changed by right-clicking on the system tray icon.

Ok, thanks, great tip !

Share this post


Link to post
Share on other sites

Sry to dredge up an old thread but i saw this today and know the answer...

what everyone missed from your posted picture was that the Title of the window had changed slightly and you had not taken into account the change also.

WinWaitActive("Setup - VNC", "Setup is now ready to begin installing VNC on your computer.", 3000)

should have been "Setup - VNC " note the space after C this would have solved the exact problem you were having!

Pebbles

Share this post


Link to post
Share on other sites

...i saw this today and know the answer...

An electronic search of this thread shows no sign of the WinTextMatchMode being changed from the default setting of 1 = Match the title from the start (default)

So, unless you change the AutoItSetOption setting for WinTextMatchMode, the following would have the same effect:

WinWaitActive("Setup - VNC ",...

WinWaitActive("Setup - VNC",...

WinWaitActive("Setup - VN",...

WinWaitActive("Setup - V",...

....


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

ignore my post, it seems i have since changed my ways!

Edited by P388l3s

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