Jump to content

Scripts doesn't works after migration to Win7


coucou
 Share

Recommended Posts

Hello,

I'm WinXP user and will migrate to Win7 very soon. I've several AutoIt installer scripts tested working on WinXP.

A week ago, I tested the here bellow script for a silent install and registration. Except the fact that Win7 ask to use As Administrator, the install goes right but NOT the registartion.

1) How to get Ride from "As Administrator" (what to add/modify in my scripts)?

2) What to modify in the following script (Install and Register working on WinXP but NO registration on Win7)

I'll appreciate any help

Regards

;Variable
$ID="ABCDEF"
$SN="123456-789012-345678-901234-567890-123456-789012-345678-901234"

;Opt('TrayIconDebug', 1)

RunWait("yusetup2010.exe /VERYSILENT /SP- /NORESTART"); this line only works on Win7
Sleep(1000)
Run(@ProgramFilesDir & "\Your Uninstaller 2010\urmain.exe")

WinWaitActive("Trial reminder")
ControlClick("Trial reminder", "", "TRzButton2")
Sleep(500)
If WinExists("Enter Code") Then
  ControlSend("Enter Code", "", "TEdit2", $ID);Name
  ControlSend("Enter Code", "", "TEdit1", $SN);Serial
  ControlClick("Enter Code", "", "TRzBitBtn2"); OK
EndIf
WinWaitActive("Information")
ControlClick("Information", "", "TButton1"); OK
If WinExists("Tips") Then
  ControlClick("Tips", "", "TButton3");Close
EndIf

Sleep(1000)
;Process Close
Sleep(3000)
$pid = ("urmain.exe")
;Process Close
ProcessWait($pid, 50)
Sleep(1000)
        For $i = 1 To 10 Step 1
            If ProcessExists($pid) Then
                ProcessClose($pid)
                Sleep(500)
            Else
                ExitLoop
            EndIf
Next
Link to comment
Share on other sites

You need to XXXXX out serial numbers and username before you get tossed!

Does the program run when you call it from the run line? Are you running x64 Windows, and are you running with 64bit or x86 AutoIT? If compiled, with which Architecture was it compiled?

Edited by Varian
Link to comment
Share on other sites

Hi,

If you look at the seial closely, you'll notice that is series of 1234567890...

All runing architectures (WinXP, Win7 and AutoIt) are x86. I'm using the latest AutoitIt public release 3.3.6.1. All my scripts was compiled with AutoIt x86.

The program does NOT run when I call it from the next run line

Run(@ProgramFilesDir & "\Your Uninstaller 2010\urmain.exe")

I added a t the top of the script #RequireAdmin like here bellow

#RequireAdmin<BR>Run(@ProgramFilesDir & "\Your Uninstaller 2010\urmain.exe")

This time, the program run but still I have a UAC message (see here bellow)

post-5679-12844558295363_thumb.jpg

Regards

Edited by coucou
Link to comment
Share on other sites

Hi coucou,

I changed your code some. Look at the comments for hints. IMO it is perhaps a working directory issue as installed apps can be looking for support files in the incorrect working directory that is inherited. Look at the shortcut properties of urmain.exe in the start menu to determine the correct working directory to pass to urmain.exe via the working directory parameter of Run().

; install scripts may need to elevate to admin to handle the install correct
#RequireAdmin
Opt('TrayIconDebug', 1)

;Variable
$ID="ABCDEF"
$SN="123456-789012-345678-901234-567890-123456-789012-345678-901234"

RunWait("yusetup2010.exe /VERYSILENT /SP- /NORESTART"); this line only works on Win7
If @error Then
    Exit 1
Else
    Sleep(1000)
    ; installed apps may need a certain working directory passed
    ; so the variable below may help (perhaps your main issue of failure).
    ; check if working directory is correct by looking at the shortcut in the "Start In" field
    $WD = @ProgramFilesDir & "\Your Uninstaller 2010"
    ; protect paths that may contain white space using quotes
    $pid = Run('"' & $WD & '\urmain.exe"', $WD)
    If @error Then
        Exit 2
    Else
        WinWait('Trial reminder')
        WinActivate('Trial reminder')
        WinWaitActive("Trial reminder")
        ControlClick("Trial reminder", "", "TRzButton2")
        Sleep(500)
        AdlibRegister('_Enter_Code'); call _Enter_Code() every 250 ms
        ;
        WinWaitActive("Information")
        ControlClick("Information", "", "TButton1"); OK
        ;
        AdlibUnRegister('_Enter_Code')
        AdlibRegister('_Tips')
        ;
        Sleep(1000)
        ;Process Close
        Sleep(3000)
;~      $pid = ("urmain.exe"); Run() gives the pid
        ;Process Close
        ProcessWait($pid, 50); 50 seconds seems long time
        ;
        AdlibUnRegister('_Tips')
        Sleep(1000)
        For $i = 1 To 10; step 1 is default
            If ProcessExists($pid) Then
                ProcessClose($pid)
                Sleep(500)
            Else
                ExitLoop
            EndIf
        Next
    EndIf
EndIf

Exit

Func _Enter_Code()
    If WinExists("Enter Code") Then
        WinActivate('Enter Code'); perhaps activate if needed
        If WinActive('Enter Code') Then
            ControlSend("Enter Code", "", "TEdit2", $ID);Name
            ControlSend("Enter Code", "", "TEdit1", $SN);Serial
            ControlClick("Enter Code", "", "TRzBitBtn2"); OK
        EndIf
    EndIf
EndFunc

Func _Tips()
    If WinExists("Tips") Then
      ControlClick("Tips", "", "TButton3");Close
    EndIf
EndFunc

;)

Link to comment
Share on other sites

Many Thanks MHz, You've been always my savior Posted Image

Works like a charm.

BTW, I've disabled the UAC thanks to AlienStar POST

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"ConsentPromptBehaviorAdmin"=dword:00000000

Regards

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...