bbrian Posted December 28, 2007 Share Posted December 28, 2007 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"):checkUtilitiesFolderif not exist "%allusersprofile%\Start Menu\Programs\Accessories\Utilities" (goto createUtilitiesFolder) else (goto checkPowertoysShortcut) :createUtilitiesFoldermd "%allusersprofile%\Start Menu\Programs\Accessories\Utilities":checkPowertoysShortcutif exist "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP\Tweak UI.lnk" (goto movePowertoysShortcut) else (goto checkPowertoysShortcutFolder):movePowertoysShortcutmove "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP\Tweak UI.lnk" "%allusersprofile%\Start Menu\Programs\Accessories\Utilities":checkPowertoysShortcutFolderif exist "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP" (goto deletePowertoysShortcutFolder) else (goto end):deletePowertoysShortcutFolderrmdir "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP" /q /s:endI 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. Link to comment Share on other sites More sharing options...
MHz Posted December 29, 2007 Share Posted December 29, 2007 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 necessaryIf 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 itIf FileExists(@ProgramsCommonDir & "\Powertoys for Windows XP") Then DirRemove(@ProgramsCommonDir & "\Powertoys for Windows XP", 1)EndIfSee if the above changes helps you.Some advice: Waiting for each identified window during installation may make your script more reliable. Link to comment Share on other sites More sharing options...
bbrian Posted December 29, 2007 Author Share Posted December 29, 2007 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now