MSFN Forum: Autoit + WIWW can't manipulate shortcuts - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Autoit + WIWW can't manipulate shortcuts works fine without WIWW Rate Topic: -----

#1 User is offline   bbrian 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 25-September 07

Posted 28 December 2007 - 04:29 PM

I'm trying to silently install TweakUI (XP Powertoys) by using an AutoIt script and using the Windows Installer Wrapper Wizard (WIWW) to turn that into an MSI.

The AutoIt script for installing TweakUI always works fine.
Then it should move the shortcuts around. I've tried scripting it inside AutoIt and by calling a CMD script. Both work fine until I use WIWW. I even put in a 10s delay between the install and the shortcut manupulation. It seems the shortcuts are locked until WIWW finishes.


Run("TweakUiPowertoySetup.exe")
WinWaitActive("Microsoft Powertoys for Windows XP and Windows Server 2003 Setup", "&Next >")
Send("!N")
Send("!a")
Send("!N")
Send("{ENTER}")

; Check for a \Accessories\Utilities
; and create it if necessary
;If Not FileExists(@ProgramsCommonDir & "\Accessories\Utilities") Then
;	DirCreate (@ProgramsCommonDir & "\Accessories\Utilities")
;EndIf

; Check for shortcut
; and copy it to utilities.
;If FileExists(@ProgramsCommonDir & "\Powertoys for Windows XP\Tweak UI.lnk") Then
;	Filecopy(@ProgramsCommonDir & "\Powertoys for Windows XP\Tweak UI.lnk", @ProgramsCommonDir & "\Accessories\Utilities")
;EndIf

; Check for shortcut folder
; and delete it
;If FileExists(@ProgramsCommonDir & "\Powertoys for Windows XP") Then
;	DirRemove(@ProgramsCommonDir & "\Powertoys for Windows XP",1)
;EndIf

; Linked CMD script to replace above shortcut manipulation.
; Timing experimenting to solve.
sleep(10000)

Run("TweakUiPowertoySetup.exe.cmd")


:checkUtilitiesFolder
if not exist "%allusersprofile%\Start Menu\Programs\Accessories\Utilities" (goto createUtilitiesFolder) else (goto checkPowertoysShortcut) 

:createUtilitiesFolder
md "%allusersprofile%\Start Menu\Programs\Accessories\Utilities"

:checkPowertoysShortcut
if exist "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP\Tweak UI.lnk" (goto movePowertoysShortcut) else (goto checkPowertoysShortcutFolder)

:movePowertoysShortcut
move "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP\Tweak UI.lnk" "%allusersprofile%\Start Menu\Programs\Accessories\Utilities"

:checkPowertoysShortcutFolder
if exist "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP" (goto deletePowertoysShortcutFolder) else (goto end)

:deletePowertoysShortcutFolder
rmdir "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP" /q /s

:end



I guess I could put the CMD script in RunOnce but that doesn't seem ideal. I imagine I'm not the first person to come across this. I assume there's a file attribute I can change with AutoIt that will allow me do what I want.

Cheers.


#2 User is offline   MHz 

  • SendToA3X v1.7
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,634
  • Joined: 02-August 04

Posted 28 December 2007 - 10:02 PM

So long as the TweakUiPowertoySetup.exe process waits while the spawned msi process does the installation, then you can use the return of the process identification number (PID) from Run() to wait for the TweakUiPowertoySetup.exe process to close.

Changes made...
 
$pid = Run("TweakUiPowertoySetup.exe")
WinWaitActive("Microsoft Powertoys for Windows XP and Windows Server 2003 Setup", "&Next >")
Send("!N")
Send("!a")
Send("!N")
Send("{ENTER}")
ProcessWaitClose($pid)

; Check for a \Accessories\Utilities
; and create it if necessary
If Not FileExists(@ProgramsCommonDir & "\Accessories\Utilities") Then
	DirCreate (@ProgramsCommonDir & "\Accessories\Utilities")
EndIf

; Check for shortcut
; and copy it to utilities.
If FileExists(@ProgramsCommonDir & "\Powertoys for Windows XP\Tweak UI.lnk") Then
	Filecopy(@ProgramsCommonDir & "\Powertoys for Windows XP\Tweak UI.lnk", @ProgramsCommonDir & "\Accessories\Utilities")
EndIf

; Check for shortcut folder
; and delete it
If FileExists(@ProgramsCommonDir & "\Powertoys for Windows XP") Then
	DirRemove(@ProgramsCommonDir & "\Powertoys for Windows XP", 1)
EndIf
 

See if the above changes helps you.

Some advice: Waiting for each identified window during installation may make your script more reliable.

:)

#3 User is offline   bbrian 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 25-September 07

Posted 28 December 2007 - 10:58 PM

View PostMHz, on Dec 29 2007, 05:02 AM, said:

So long as the TweakUiPowertoySetup.exe process waits while the spawned msi process does the installation, then you can use the return of the process identification number (PID) from Run() to wait for the TweakUiPowertoySetup.exe process to close.

Some advice: Waiting for each identified window during installation may make your script more reliable.


Worked first time. Thank you very much. I see exactly what you mean and have noticed it when reading other people's scripts. I'll definitely pay attention.

It's 5am on Friday night, I can't believe I just spent the past 12 hours figuring out silent installs.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy