coucou Posted January 18, 2011 Share Posted January 18, 2011 Hello,Since while I'm trying to install Win7codecs silently withou success. There is a silent switch to install it as it. If so, a WeatherBug plugins adds will be installed too. Therefore I had to write a script for the silent install.Here bellow the script as well as the Win7codecs.msi file.1) My script works just fine when I launch it on a windows session.2) During Unattended installation, my script frequently freeze when (IE) ProcessClose is called, sometimes at "Finish" and sometimes i get the here bellow message.Anyway the problem start at line 43 AdlibRegister("_Adlib")I'll appreciate any helpRegardsexpandcollapse popup;#RequireAdmin Opt('TrayIconDebug', 1) $title = "Win7codecs - Win7codecs by Shark007" ;Run("msistub.exe Win7codecs_273.msi") ShellExecute("Win7Codecs_273.msi") ;Welcome WinWaitActive($title, "Welcome") Sleep(2000) ControlClick($title, "Welcome", "Button1") ;License Agreement WinWaitActive($title, "License Agreement") Sleep(500) ControlClick($title, "License Agreement", "Button3"); I accept Sleep(500) ControlClick($title, "License Agreement", "Button5"); Next ;Destination Folder WinWaitActive($title, "Destination Folder") Sleep(500) ControlClick($title, "Destination Folder", "Button1"); Next ;Installing the Bing Toolbar WinWaitActive($title, "Install WeatherBug") Sleep(500) ControlClick($title, "Install WeatherBug", "Button4"); Uncheck Sleep(500) ControlClick($title, "Install WeatherBug", "Button1"); Next ;Setup Type WinWaitActive($title, "Setup Type") Sleep(500) ControlClick($title, "Setup Type", "Button5"); Complete and Next ;Install WinWaitActive($title, "Ready to Install") Sleep(500) ControlClick($title, "Ready to Install", "Button1") Sleep(18000) AdlibRegister("_Adlib") ;Finish WinWaitActive($title, "InstallShield Wizard Completed") WinActivate($title, "InstallShield Wizard Completed") Sleep(500) ControlClick($title, "InstallShield Wizard Completed", "Button1") ;send("!f") Func _Adlib() ;Process Close ;ProcessWait("iexplore.exe", 10) ;Sleep(500) For $i = 1 To 10 Step 1 If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe") Sleep(500) Else ExitLoop EndIf Next EndFunc ;==>_AdlibWin7Codecs 2.73 Link to comment Share on other sites More sharing options...
Varian Posted January 18, 2011 Share Posted January 18, 2011 Here is what I have done, mon ami! Using Orca MSI Editor, I removed the weatherbug stuff from the msi file. You may now run it silently with the standard msi switches. Assuming Internet Explorer is your default browser, this script should work for you and disable the web page popping up at the end of the installation. I had to use _ShellExecuteEx since this is an msi install and I wanted to continue the script while the installation is going on.Here is the link to the custom msi: Win7codecs_273_custom.zipexpandcollapse popup$Path = 'Path to your msi file' $Switches = '/qn /norestart' $Install = _ShellExecuteEx($Path, $Switches) ToolTip(' ', @DesktopWidth /2.5, @DesktopHeight / 2.5, 'Installing Win7Codecs Package', 1) While ProcessExists($Install) Do ProcessClose('iexplore.exe') Until Not ProcessExists('iexplore.exe') Sleep(10) WEnd If ProcessWait('iexplore.exe', 5) Then ;waits another 5 seconds after the install for any iexplore Processes ProcessClose('iexplore.exe') EndIf ; ================================================================================================= ; Func _ShellExecuteEx($sCmd, $sParams = "", $sFolder = "", $sVerb = "", $iState = @SW_SHOWNORMAL,$bCloseProcessHandle=True) ; ; Parameters are the same as ShellExecute(), except for the addition of: ; ; $bCloseProcessHandle = If True (recommended unless planning on using Process Handles), ; then the Process Handle (if received) is closed ; If False, the Process Handle (if received) is returned - this can be used to do additional work with Processes ; Usage is mostly recommended for the _ShellExecuteExWait() function and/or getting exit code. ; ; Return is different from ShellExecute() in the following way: ; Success: @error = 0, and either the process ID (if $bCloseProcessHandle is True, and process ID received) is returned, ; or a 2-element array (if $bCloseProcessHandle is False): ; $array[0]=Process ID if new process started (and process handle+ID received), ; $array[1]=Process Handle if new process started (and process handle received) ; Failure: @error set and 0 is returned ; @error = 1 = parameters error ; @error = 2 = call failed (probably due to parameter error. can use _WinAPI_GetLastError()) ; ; NOTE: Recommended to run on Windows 2000 or higher because: ; According to Microsoft at http://msdn2.microsoft.com/en-us/library/bb762154.aspx, ; Windows 95/98/Me: ShellExecuteEx is supported by the Microsoft Layer for Unicode (MSLU). ; To use this, you must add certain files to your application, ; as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems. ; So it appears it will break on those machines without MSLU(?) ; ; Initial Code from MrCreatoR on AutoIt Forum Topic:: http://www.autoitscript.com/forum/index.php?showtopic=69868 ; Enhancements/Modifications by: Ascend4nt ; (including process handle/ID extract & close-handle code, plus Unicode/path enhancements, & CoInitializeEx call) ; ================================================================================================= Func _ShellExecuteEx($sCmd, $sParams = "", $sFolder = "", $sVerb = "", $iState = @SW_SHOWNORMAL,$bCloseProcessHandle=True) Local $stINFO,$stVerb,$stPath,$stArgs,$stWDir,$aRet,$hWnd=0,$aProcessArray[2]=[0,0] Local $iParamLen,$iCmdLen,$iFolderLen $iParamLen=StringLen($sParams) ; Verify string lengths are less than maximum. ; Through testing, 1997 (1996+1 NULL-term) is the maximum parameter length for this call (Unicode) If $iParamLen>1996 Then Return SetError(1,0,0) $iCmdLen=StringLen($sCmd) ; Verify string lengths are less than maximum. [MAX_PATH is 260, but Unicode allows exceptions] ; 32767 max length for Unicode strings if prefixed with '\\?\' If $iCmdLen>259 Then ; 32767-NULL=32766 - 4 (\\?\) = 32762 If $iCmdLen>(32766-4) Then Return SetError(1,0,0) $sCmd='\\?\' & $sCmd EndIf $iFolderLen=StringLen($sFolder) ; Verify string lengths are less than maximum. [MAX_PATH is 260, but Unicode allows exceptions] ; 32767 max length for Unicode strings if prefixed with '\\?\' If $iFolderLen>259 Then ; 32767-NULL=32766 - 4 (\\?\) = 32762 If $iFolderLen>(32766-4) Then Return SetError(1,0,0) $sFolder='\\?\' & $sFolder EndIf ; Setup string structures $stVerb = DllStructCreate("wchar["&(StringLen($sVerb)+1)&"]") $stPath = DllStructCreate("wchar[" &($iCmdLen+1)& "];wchar") $stArgs = DllStructCreate("wchar[" &($iParamLen+1)& "];wchar") $stWDir = DllStructCreate("wchar[" &($iFolderLen+1)& "];wchar") ; Initialize string structures (which are then used by pointer in the larger SHELLEXECUTEINFO structure) DllStructSetData($stVerb, 1, $sVerb) DllStructSetData($stPath, 1, $sCmd) DllStructSetData($stWDir, 1, $sFolder) DllStructSetData($stArgs, 1, $sParams) ; SHELLEXECUTEINFO structure $stINFO = DllStructCreate("ulong;ulong;long;ptr;ptr;ptr;ptr;long;long;ptr;ptr;long;ulong;long;long") ; SHELLEXECUTEINFO structure initialize DllStructSetData($stINFO, 1, DllStructGetSize($stINFO)) ; cbSize, size (in bytes) of structure ; ------------------------------------------------------------------------------------------------------ ; fMask Options: ; 0x40 = SEE_MASK_NOCLOSEPROCESS. The 15th element in structure (hProcess) will be set with the Process handle ; NOTE: per MSDN, this handle *must* be closed by the caller. (similar to how "OpenProcess" must use "CloseProcess") ; 0x400 = SEE_MASK_FLAG_NO_UI = Do not display an error message box if an error occurs. ; This is not default ShellExecute() behavior, which will display the error message box ; ------------------------------------------------------------------------------------------------------ DllStructSetData($stINFO, 2, BitOR(0x40,0x400)) ; fMask ; HWND - MSDN: A window handle to any message boxes that the system might produce while executing this function. DllStructSetData($stINFO, 3, $hWnd) ; Is this supposed to *receive* instead of send? I have yet to get clarity on this. DllStructSetData($stINFO, 4, DllStructGetPtr($stVerb)) ; lpVerb: pointer to the verb string DllStructSetData($stINFO, 5, DllStructGetPtr($stPath)) ; lpFile: pointer to the $cmd string DllStructSetData($stINFO, 6, DllStructGetPtr($stArgs)) ; lpParameters: pointer to the parameters/arguments string DllStructSetData($stINFO, 7, DllStructGetPtr($stWDir)) ; lpDirectory: pointer to working directory string DllStructSetData($stINFO, 8, $iState) ; nShow = state to show window as #cs ; ------------------------------------------------------------------------------------------------------ ; Per MSDN Documentation, the following call should be done prior to calling ShellExecuteEx: ; CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) ; COINIT_APARTMENTTHREADED = 0x2,COINIT_DISABLE_OLE1DDE = 0x4 ; Reason: ; "Because ShellExecuteEx can delegate execution to Shell extensions (data sources, context menu handlers, verb implementations) ; that are activated using Component Object Model (COM), COM should be initialized before ShellExecuteEx is called. ; Some Shell extensions require the COM single-threaded apartment (STA) type. In that case, COM should be initialized as shown here. ; There are certainly instances where ShellExecuteEx does not use one of these types of Shell extension and those instances would not ; require COM to be initialized at all. Nonetheless, it is good practice to always initalize COM before using this function." ; ------------------------------------------------------------------------------------------------------ #ce DllCall("ole32.dll", "int", "CoInitializeEx", "ptr", Chr(0), "dword", BitOR(2,4)) ; I don't care if it succeeds. Doesn't seem to make much difference even to call it. $aRet=DllCall("shell32.dll", "int", "ShellExecuteExW", "ptr", DllStructGetPtr($stINFO)) If @error Or Not $aRet[0] Then ; DLLStructDelete()'s: $stINFO=0 $stVerb=0 $stPath=0 $stArgs=0 $stWDir=0 Return SetError(2,@error,0) EndIf ; Get Process Handle, if one exists (non-NULL if new process started, otherwise ; NULL if app that performs 'verb' is already running, or is perhaps a 'properties' dialog etc) $aProcessArray[1]=DllStructGetData($stINFO,15) ; Get Process ID from Handle If ($aProcessArray[1]) Then $aRet=DllCall("Kernel32.dll","dword","GetProcessId","long",$aProcessArray[1]) If IsArray($aRet) Then $aProcessArray[0]=$aRet[0] EndIf ;ConsoleWrite("Handle passed to function:" & Number($hWnd) & ", Handle AFTER call:" & Number(DllStructGetData($stINFO,3)) & @CRLF) ;ConsoleWrite("Process Handle:" & Number($hProcess) & ", Process ID:" & Number($vProcessID) & @CRLF) ; Close Handle If $bCloseProcessHandle And $aProcessArray[1] Then DllCall('kernel32.dll','ptr', 'CloseHandle','ptr', $aProcessArray[1]) ; DLLStructDelete()'s: $stINFO=0 $stVerb=0 $stPath=0 $stArgs=0 $stWDir=0 If ($bCloseProcessHandle) Then Return SetError(0,0,$aProcessArray[0]) SetError(0,0) Return $aProcessArray EndFunc Link to comment Share on other sites More sharing options...
coucou Posted January 18, 2011 Author Share Posted January 18, 2011 Many TNX mon ami Oooopss I forgot Orca, I'm using it too 1) What tables, action.... did you deleted from the original Win7codecs_273.msi?2) I tested Win7codecs_273_custom.msi /qb ... works like a charm3) I tested yr appropriate script to install it... I got the here above message "There was problem sending..."4) I prpared a 7zsd.sfx file (compress (Ultra) Win7codecs_273_custom.msi with 7zip, write the file config.txt...) tested working like a charm (complete files link here bellow)5) I have an idea why don't use Orca to delete Tables: CustomActionAction: SetupInfo Target: explorer.exe http://shark007.net/win7codecs.html RegardsWin7codecs_273_custom_2.zip Link to comment Share on other sites More sharing options...
coucou Posted January 18, 2011 Author Share Posted January 18, 2011 Hi Varian,I'm using Orca 5.0.6764.0.I opened yr Win7codecs_273_custom.msi find Tables: CustomAction and droprd Action: SetupInfo Target: explorer.exe http://shark007.net/win7codecs.html, then I saved as Win7codecs_273_custom_TEST.msi the file I got is only 6,7 MB instead of 24,8 MB. Got a same result with my original Win7codecs_273.msi I did something wrong?Regards Link to comment Share on other sites More sharing options...
Varian Posted January 18, 2011 Share Posted January 18, 2011 (edited) I don't have that late a version of Orca...I am using v3.1.4. But I get the same thing if I save to a new file, even without making any changes. If I save the file directly, the size remains the same. Please test with an unaltered version from the website. I'm doing the same on my end, and I'll report my findings Edited January 18, 2011 by Varian Link to comment Share on other sites More sharing options...
coucou Posted January 19, 2011 Author Share Posted January 19, 2011 I don't have that late a version of Orca...I am using v3.1.4. But I get the same thing if I save to a new file, even without making any changes. If I save the file directly, the size remains the same. Please test with an unaltered version from the website. I'm doing the same on my end, and I'll report my findingsThat what I did , When I wrote here above "Got a same result with my original Win7codecs_273.msi" it means: I've tested an unaltered version from the website.Right now I did the same:1) Opened an unaltered version, drpped a row and save... Same size 24 815KB2) Opened an unaltered version, drpped a row and save as... size 6717 KB3) Dis same tests with your file, got same results for save and save as.BTW, did you test my Win7codecs_273_custom_2.zip ? Regards Link to comment Share on other sites More sharing options...
coucou Posted January 19, 2011 Author Share Posted January 19, 2011 Hi Varian,good news here.I tested installing the "save as" win7codecs (6717 KB) I got the next error message "error 2356. Could not locate cabinet in stream: Data1.cab"Then I opened yr win7codecs (with WeatherBug dropped row). Idroped Action: SetupInfo Target: explorer.exe http://shark007.net/win7codecs.html, and saved it (24815 KB)... Tested No more WeatherBug, IE neither May you let me know what row exactly you dropped to get WeatherBug disabled?Regards Link to comment Share on other sites More sharing options...
Varian Posted January 19, 2011 Share Posted January 19, 2011 Got those same results as well, coucou. As far as the removes go, the quick and dirty is to search for "weather" and remove those items, and everything starting with "WB" Link to comment Share on other sites More sharing options...
coucou Posted January 19, 2011 Author Share Posted January 19, 2011 Cher ami,May be this will intersesting you SuperOrca InstEd Orca 2007 Orca MSI EditorLet me know further 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