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.
CODE
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")
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")
CODE
: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
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.
