Ruigerock Posted July 17, 2006 Share Posted July 17, 2006 (edited) Hello people, The more is use autoit the more "advanded" settings i want to start using. At the moment we got quicktime 7.0.3.50 installed and i want to make a installer for quicktime 7.1. The problem i am running in to is the misuse of If...Then .. Example :If FileExists("c:\Program Files\QuickTime\quicktime.exe") Then $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3868A8EE-5051-4DB0-8DF6-4F4B8A98D083}","DisplayVersion") $answer = MsgBox(0x24, 'Quicktime Update:', 'Currently Quicktime ' & $var & ' is installed' & @CRLF & 'Do you want to install Quicktime 7.1?') If $answer = 7 Then Exit ElseIf $answer = 6 Then Run("msiexec /x {3868A8EE-5051-4DB0-8DF6-4F4B8A98D083} /QN") DirRemove("c:\Program Files\QuickTime\",1) EndIf RunWait('msiexec /i ISScript11.Msi /qn') RunWait('msiexec /i QuickTime.msi ISSETUPDRIVEN=1 /qn') etc.. At the moment there is one EndIf missing. Could someone point me into the right direction (teach me a different way of thinking ?) Edited July 17, 2006 by Ruigerock Link to comment Share on other sites More sharing options...
GaryFrost Posted July 17, 2006 Share Posted July 17, 2006 If your not using SciTE I would suggest giving it a try you can tidy the code, syntax check etc. look in the tools menu. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted July 17, 2006 Share Posted July 17, 2006 maybe If FileExists("c:\Program Files\QuickTime\quicktime.exe") Then $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3868A8EE-5051-4DB0-8DF6-4F4B8A98D083}", "DisplayVersion") If MsgBox(0x24, 'Quicktime Update:', 'Currently Quicktime ' & $var & ' is installed' & @CRLF & 'Do you want to install Quicktime 7.1?') = 7 Then Exit Run("msiexec /x {3868A8EE-5051-4DB0-8DF6-4F4B8A98D083} /QN") DirRemove("c:\Program Files\QuickTime\", 1) EndIf RunWait('msiexec /i ISScript11.Msi /qn') RunWait('msiexec /i QuickTime.msi ISSETUPDRIVEN=1 /qn') ;etc.. 8) Link to comment Share on other sites More sharing options...
DaleHohm Posted July 17, 2006 Share Posted July 17, 2006 In addition to SciTe, it looks like you would benefit from learning the SELECT and SWITCH statements (SWITCH only available in the beta). Take a look at the helpfile. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Ruigerock Posted July 18, 2006 Author Share Posted July 18, 2006 @gafrost : Yes i'm using Scite but i never explored the extra functions like tidy text and syntax, i'll have a look @ the help file @Valuater : Cool! It's totally something i never would have thought of, nice technique .. thanks @DaleHohm : Indeed, i will start using the SELECT or SWITCH statements for more specific statements. Do you perhaps have some SELECT or SWITCH examples i can have a look at? Link to comment Share on other sites More sharing options...
McGod Posted July 18, 2006 Share Posted July 18, 2006 $i = 1 Select Case $i = 1 MsgBox ( 1, "I", "I equals 1" ) Case $i = 2 MsgBox ( 1, "I", "I equals 2" ) Case Else MsgBox ( 1, "I", "I equals something other then 1 or 2!" ) EndSelect [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
jvanegmond Posted July 18, 2006 Share Posted July 18, 2006 $i = 1 MsgBox(1,"I", "I equals "&$i) That example was so lame, I just couldn't help myself. github.com/jvanegmond Link to comment Share on other sites More sharing options...
McGod Posted July 18, 2006 Share Posted July 18, 2006 (edited) I know A new one $example = InputBox ( "Input", "Input A B or C" ) Select Case $example = "A" MsgBox ( 1, "Example", "You inputted A" ) Case $example = "B" MsgBox ( 1, "Example", "You inputted B" ) Case $example = "C" MsgBox ( 1, "Example", "You inputted C" ) Case Else MsgBox ( 1, "Example", "You didnt input A B or C" ) EndSelect $example = InputBox ( "Input", "Input A B or C" ) If $example = "A" Then MsgBox ( 1, "Example", "You inputted A" ) ElseIf $example = "B" Then MsgBox ( 1, "Example", "You inputted B" ) ElseIf $example = "C" Then MsgBox ( 1, "Example", "You inputted C" ) Else MsgBox ( 1, "Example", "You didnt input A B or C" ) EndIf It will ask twice, one uses Ifs one uses Select. Edited July 18, 2006 by Chip [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Ruigerock Posted July 19, 2006 Author Share Posted July 19, 2006 (edited) Hi there, thanks for the examples. I've tried the following adjustment and it works!If FileExists("c:\Program Files\QuickTime\QuickTimePlayer.exe") Then ;The binary file whose version we will check. $AppBinFile = "c:\Program Files\QuickTime\QuickTimePlayer.exe" $CurrentVer = FileGetVersion ( $AppBinFile ) Select Case $CurrentVer = "7.0.3.50" ;CAB code from 7.0.3.50 Run("msiexec /x {3868A8EE-5051-4DB0-8DF6-4F4B8A98D083} /QN") DirRemove("c:\Program Files\QuickTime\",1) Case $CurrentVer = "7.0.0.0" ;CAB code from 7.0.0.0 (fictional) Run("msiexec /x {2009A8EE-5051-4DB0-8DF6-4F4B8A98D083} /QN") DirRemove("c:\Program Files\QuickTime\",1) Case $CurrentVer = "7.1.0.0" ;CAB code from 7.1.0.0 (fictional) Run("msiexec /x {1114A8EE-5051-4DB0-8DF6-4F4B8A98D083} /QN") DirRemove("c:\Program Files\QuickTime\",1) Case Else MsgBox ( 1, "Sorry", "No Quicktime / Known version Quicktime was found" ) Exit EndSelect EndIf ;Installation newest quicktime ;Run("QuicktimeInstaller.exe /S /v/qn") etc.. The select worked perfectly, in stead of multiple IF ..Then the Case did the job! Too bad the uninstallation of Quicktime itself gave an missing dll error at my computer Anybody knows how to fix this new problem ?? Edited July 19, 2006 by Ruigerock 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