grtech Posted June 26, 2009 Share Posted June 26, 2009 ok got a slight issue here. basically what i want is, if one file exist then to run it, but if that file doesnt exist and another one does then to run that one, but if none of them exist then to popup and error message and end the script. CODEif FileExists("C:\Program Files\Microsoft Office\Office12\Outlook.exe") Then $ver = FileGetVersion("outlook.exe") $Version = "12" EndIf if FileExists("C:\Program Files\Microsoft Office\Office11\Outlook.exe") Then $ver = FileGetVersion("outlook.exe") $Version = "11" EndIf #cs MsgBox(0, "outlook version", $version) #ce MsgBox(49, "Outlook update.", "Outlook is about to be updated by GROUPIT. Please wait until the process has completed. This message will close in 10 seconds", 10) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) if not ProcessExists("OUTLOOK.EXE") Then if $Version = "11" Then Run('C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE') WinWait("Inbox - Microsoft Outlook","NUIDocumentWindow") ; EndIf if $Version = "12" Then Run('C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE') WinWait("Inbox - Microsoft Outlook","NUIDocumentWindow") Else MsgBox(17, "Outlook update.", "Error! Unable to locate OUTLOOK. Please report to GROUPIT via an OTIS now.", 10) exit 1 EndIf EndIf Link to comment Share on other sites More sharing options...
akhenertai Posted June 26, 2009 Share Posted June 26, 2009 grtech try to use the If..ElseIf.. Else statement, might solve it Link to comment Share on other sites More sharing options...
Yoriz Posted June 26, 2009 Share Posted June 26, 2009 From the help fileIf <expression> Then statements ...[ElseIf expression-n Then [elseif statements ... ]] ...[Else [else statements] ...EndIfParametersexpression If the expression is true, the first statement block is executed. If not, the first true ElseIf block is executed. Otherwise, the "Else" block is executed. GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
bogQ Posted June 26, 2009 Share Posted June 26, 2009 ok got a slight issue here. basically what i want is, if one file exist then to run it, but if that file doesnt exist and another one does then to run that one, but if none of them exist then to popup and error message and end the script. this can probably work Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Select Case FileExists("C:\Program Files\Microsoft Office\Office12\Outlook.exe") $ver = FileGetVersion("outlook.exe") $Version = "12" Case FileExists("C:\Program Files\Microsoft Office\Office11\Outlook.exe") $ver = FileGetVersion("outlook.exe") $Version = "11" Case Else MsgBox(17, "Outlook update.", "Error! Unable to locate OUTLOOK. Please report to GROUPIT via an OTIS now.", 10) Exit EndSelect MsgBox(49, "Outlook update.", "Outlook is about to be updated by GROUPIT. Please wait until the process has completed. This message will close in 10 seconds", 10) if not ProcessExists("OUTLOOK.EXE") Then Run("C:\Program Files\Microsoft Office\OFFICE"&$Version&"\OUTLOOK.EXE") WinWait("Inbox - Microsoft Outlook","NUIDocumentWindow") EndIf TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.  Link to comment Share on other sites More sharing options...
grtech Posted June 26, 2009 Author Share Posted June 26, 2009 (edited) der lol i have used that before as well, yes that works well and have now changed to select script, but not i have added the rest and having an issue with the second part running. this is my full script expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) Select Case FileExists("C:\Program Files\Microsoft Office\Office12\Outlook.exe") $ver = FileGetVersion("outlook.exe") $Version = "12" Case FileExists("C:\Program Files\Microsoft Office\Office11\Outlook.exe") $ver = FileGetVersion("outlook.exe") $Version = "11" Case Else MsgBox(17, "Outlook update.", "Error! Unable to locate OUTLOOK. Please report to GROUPIT via an OTIS now.", 10) Exit EndSelect MsgBox(49, "Outlook update.", "Outlook is about to be updated by GROUPIT. Please wait until the process has completed. This message will close in 10 seconds", 10) if not ProcessExists("OUTLOOK.EXE") Then Run("C:\Program Files\Microsoft Office\OFFICE"&$Version&"\OUTLOOK.EXE") WinWait("Inbox - Microsoft Outlook","NUIDocumentWindow") ; EndIf If Not WinActive("Inbox - Microsoft Outlook","NUIDocumentWindow") Then WinActivate("Inbox - Microsoft Outlook","NUIDocumentWindow") WinWaitActive("Inbox - Microsoft Outlook","NUIDocumentWindow") Send("{ALTDOWN}to{ALTUP}") WinWait("Options","Change the appearanc") If Not WinActive("Options","Change the appearanc") Then WinActivate("Options","Change the appearanc") WinWaitActive("Options","Change the appearanc") Send("{SHIFTDOWN}{TAB}{SHIFTUP}{RIGHT}") WinWait("Options","Set up e-mail accoun") If Not WinActive("Options","Set up e-mail accoun") Then WinActivate("Options","Set up e-mail accoun") WinWaitActive("Options","Set up e-mail accoun") Send("{RIGHT}") WinWait("Options","Choose a format for ") If Not WinActive("Options","Choose a format for ") Then WinActivate("Options","Choose a format for ") WinWaitActive("Options","Choose a format for ") Send("{RIGHT}") #cs this is outlook 2003 #ce if $Version = "11" Then WinWait("Options","Always &suggest repl") If Not WinActive("Options","Always &suggest repl") Then WinActivate("Options","Always &suggest repl") WinWaitActive("Options","Always &suggest repl") Send("{RIGHT}") #cs security tab in 2003 #ce WinWait("Options","&Encrypt contents an") If Not WinActive("Options","&Encrypt contents an") Then WinActivate("Options","&Encrypt contents an") WinWaitActive("Options","&Encrypt contents an") EndIf #cs this is outlook 2007 #ce if $Version = "12" Then WinWait("Options","Always &check spell") If Not WinActive("Options","Always &check spell") Then WinActivate("Options","Always &check spell") WinWaitActive("Options","Always &check spell") EndIf Send("{RIGHT}") WinWait("Options","&Empty the Deleted I") If Not WinActive("Options","&Empty the Deleted I") Then WinActivate("Options","&Empty the Deleted I") WinWaitActive("Options","&Empty the Deleted I") Send("{ALTDOWN}t{ALTUP}") WinWait("AutoArchive","&Run AutoArchive eve") If Not WinActive("AutoArchive","&Run AutoArchive eve") Then WinActivate("AutoArchive","&Run AutoArchive eve") WinWaitActive("AutoArchive","&Run AutoArchive eve") Send("{ALTDOWN}l{ALTUP}") ;send("{TAB 11}") ;sleep(1000) WinWaitActive("AutoArchive","&Run AutoArchive eve") ControlClick("AutoArchive","", 1) ;Send("{ENTER}") ;sleep(1000) ;send("{TAB}") ;Send("{ENTER}") ;sleep(1000) WinWait("Options","&Empty the Deleted I") If Not WinActive("Options","&Empty the Deleted I") Then WinActivate("Options","&Empty the Deleted I") WinWaitActive("Options","&Empty the Deleted I") ControlClick("Options","&Empty the Deleted I", 1) ;Send("{TAB 11}") ;sleep(1000) ;send("{Enter}") sleep(1000) MsgBox(65, "Outlook update.", "Outlook update by GROUPIT. The update is now completed. Thank you for co-operating. Any issues please log an OTIS in the normal manor", 10) EndIf Edited June 26, 2009 by grtech Link to comment Share on other sites More sharing options...
grtech Posted June 26, 2009 Author Share Posted June 26, 2009 forget it i have solved it, i needed to move an endif... Thanks for your help guys GRTech 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