Jump to content

AasimPathan

Active Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by AasimPathan

  1. Can someone help me finalize this, currently i am getting an error: "C:\Users\username\Desktop\U_A_A_OneClickDeployment_MatrixCodeBase.au3" (59) : ==> Subscript used on non-accessible variable.: If $GetMSIVersion[0] = $GetInstalledVersion[0] And $GetMSIVersion[1] <> $GetInstalledVersion[1] Then If $GetMSIVersion[0] = $GetInstalledVersion^ ERROR Basically what I did was first I am using AutoIT to extract the version of the installed software to a txt file. Then I am getting the version of MSI file. Then comparing the 2 version. So for eg. If installed Version is 1.0.0.0 or 0.0.9.0 etc. & MSI version is 1.0.1.0 we install the new package. But If installed version is 1.0.1.0 & MSI version is 1.0.1.0 we install do not install the package. #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <Misc.au3> #include <File.au3> #include <StringConstants.au3> $user = "DomainUser" $pass = "Password" $domain = "Domain" GetLocalInstalledVersion() Func GetLocalInstalledVersion() $sTextFile = ("A:\U_A\U_W\C_NonFiledFiles\GetVersion.txt") Run ( "notepad.exe " & $sTextFile, @WindowsDir, @SW_MAXIMIZE ) Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) Local $aSoftwareList = _SoftwareList("Matrix Code Base") ;Search for specific software. GetMSIPackageVersion() EndFunc Func _SoftwareList($sSoftwareName = '') ;Search for MSI/Microsoft installed software using WindowsInstaller.Installer COM object. Local $oMyError = ObjEvent("AutoIt.Error", "_ComError") ;COM Error Handler #forceref $oMyError Local $aSoftwareList[1][3] Local $oInstaller = ObjCreate('WindowsInstaller.Installer') If Not IsObj($oInstaller) Then Return SetError(1, 0, $aSoftwareList) Local $Products = $oInstaller.Products For $Product In $Products If $sSoftwareName <> '' And Not StringInStr($oInstaller.ProductInfo($Product, 'ProductName'), $sSoftwareName) Then ContinueLoop ReDim $aSoftwareList[UBound($aSoftwareList) + 1][3] $aSoftwareList[UBound($aSoftwareList) - 1][0] = $oInstaller.ProductInfo($Product, 'ProductName') $aSoftwareList[UBound($aSoftwareList) - 1][1] = $oInstaller.ProductInfo($Product, 'VersionString') $aSoftwareList[UBound($aSoftwareList) - 1][2] = $oInstaller.ProductInfo($Product, 'InstallLocation') ClipPut($oInstaller.ProductInfo($Product, 'VersionString')) WinActivate ("[CLASS:Notepad]", "") Send("^a") Send("^v") Send("^s") Sleep(100) WinClose("[CLASS:Notepad]", "") Next $aSoftwareList[0][0] = UBound($aSoftwareList) - 1 Return $aSoftwareList EndFunc Func GetMSIPackageVersion() If FileExists("*\MatrixCodeBase.msi") Then $sMSI = "*\MatrixCodeBase.msi" EndIf While 1 Sleep(25) Local $GetMSIVersion = CheckMSIVersion($sMSI) ; get the version info of the msi installer Local $GetInstalledVersion = FileReadLine(FileOpen("*\GetVersion.txt"), 1) ; get the version info of the installed software. If $GetMSIVersion[0] = $GetInstalledVersion[0] And $GetMSIVersion[1] <> $GetInstalledVersion[1] Then CloseRunningOfficePrograms() EndIf WEnd EndFunc Func CloseRunningOfficePrograms() ;Closes all Running Microsoft Office Programs If ProcessExists("WINWORD.EXE") Then ProcessClose("WINWORD.EXE") If ProcessExists("EXCEL.EXE") Then ProcessClose("EXCEL.EXE") If ProcessExists("OUTLOOK.EXE") Then ProcessClose("OUTLOOK.EXE") If ProcessExists("VISIO.EXE") Then ProcessClose("VISIO.EXE") If ProcessExists("POWERPNT.EXE") Then ProcessClose("POWERPNT.EXE") InstallMatrixCodeBase() EndFunc Func InstallMatrixCodeBase() ;Install Matrix Code Base FileCopy("*\MatrixCodeBase.msi", "C:\Install") ;RunAsWait($user, $domain, $pass, 0, "msiexec /i C:\Install\MatrixCodeBase.msi /passive") ;Commented out because testing the process FileDelete("C:\Install\MatrixCodeBase.msi") EndFunc ;Miscellenous Functions required to run the primary scripts Func CheckMSIVersion($sMSI) $oInstaller = ObjCreate("WindowsInstaller.Installer") $oDB = $oInstaller.OpenDataBase($sMSI, 0) $oView = $oDB.OpenView("SELECT Property,Value FROM Property") $oView.Execute() $oCount = 0 $pName = "" $pVer = 0 While @error = 0 $oRecords = $oView.Fetch $oPropValue = $oRecords.StringData(2) $oPropName = $oRecords.StringData(1) If $oPropName <> "" Then $oCount += 1 ConsoleWrite($oPropName & " = " & $oPropValue & @CRLF) If $oPropName = "ProductName" Then $pName = $oPropValue EndIf If $oPropName = "ProductVersion" Then $pVer = $oPropValue EndIf If $pName <> "" And $pVer <> 0 Then Local $pVals[2] = [$pName, $pVer] Return $pVals EndIf EndIf WEnd EndFunc Func _ComError($oMyError) ;COM Error function defined in COM Error Handler used in COM functions. MsgBox(16, "AutoItCOM ERROR!", "COM Error Intercepted!" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) EndFunc
  2. Ps. There is no local MSI file btw There is a local installation of the msi package, so the program is installed but there is no .msi file anywhere on local computers. Would your script only work if we create a local copy of existing .msi file to the local computer? If not then i guess we would have to get version from the installed software right? Also I don't want it to run continuously, i will program Task Scheduler to run every few hours or days. so i don't need it running all the time
  3. #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> If FileExists("A:\U_A\U_W\U_Dpts\U_IT\U_Soft\C\U_Core\U_BayVL00\U_ReleaseMSIPackages\U_A_Core\U_Current\U_Source\bin\Release\MatrixCodeBase.msi") Then $sMSI = "A:\U_A\U_W\U_Dpts\U_IT\U_Soft\C\U_Core\U_BayVL00\U_ReleaseMSIPackages\U_A_Core\U_Current\U_Source\bin\Release\MatrixCodeBase.msi" EndIf While 1 Sleep(25) $lVars = CheckInfo($sMSI) ; get the version infos for the local MSI $rVars = CheckInfo("A:\U_A\U_W\U_Dpts\U_IT\U_Soft\C\U_Core\U_BayVL00\U_ReleaseMSIPackages\U_A_Core\U_Current\U_Source\bin\Release\MatrixCodeBase.msi") ; get the version infos for the remote MSI If $lVars[0] = $rVars[0] And $lVars[1] <> $rVars[1] Then DeployNewVer() EndIf WEnd Func DeployNewVer() Local $DisplayMsgBox = MsgBox($MB_YESNO, "Release components", "****Some Text***** Do you want to deploy? Press 'Yes' to Continue, Or press 'No' to Exit") Select Case $DisplayMsgBox = 6 ;Yes CloseRunningOfficePrograms() Sleep(1000) ;UninstallMatrixCodeBase() Sleep(1000) ;InstallMatrixCodeBase() Case $DisplayMsgBox = 7 ;No Exit EndSelect EndFunc ;==>DeployNewVer Func CloseRunningOfficePrograms() If ProcessExists("WINWORD.EXE") Then ProcessClose("WINWORD.EXE") If ProcessExists("EXCEL.EXE") Then ProcessClose("EXCEL.EXE") If ProcessExists("OUTLOOK.EXE") Then ProcessClose("OUTLOOK.EXE") If ProcessExists("VISIO.EXE") Then ProcessClose("VISIO.EXE") If ProcessExists("POWERPNT.EXE") Then ProcessClose("POWERPNT.EXE") EndFunc Func CheckInfo($sMSI) $oInstaller = ObjCreate("WindowsInstaller.Installer") $oDB = $oInstaller.OpenDataBase($sMSI, 0) $oView = $oDB.OpenView("SELECT Property,Value FROM Property") $oView.Execute() $oCount = 0 $pName = "" $pVer = 0 While @error = 0 $oRecords = $oView.Fetch $oPropValue = $oRecords.StringData(2) $oPropName = $oRecords.StringData(1) If $oPropName <> "" Then $oCount += 1 ConsoleWrite($oPropName & " = " & $oPropValue & @CRLF) If $oPropName = "ProductName" Then $pName = $oPropValue EndIf If $oPropName = "ProductVersion" Then $pVer = $oPropValue EndIf If $pName <> "" And $pVer <> 0 Then Local $pVals[2] = [$pName, $pVer] Return $pVals EndIf EndIf WEnd EndFunc ;==>CheckInfo Here is the full context of the script The script continues to loop >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\PathA00\Desktop\NewMSIInfo.au3"     UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer =Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Company Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 >Process failed to respond; forcing abrupt termination... >Exit code: 1    Time: 5.982
  4. Now it fails to end or respond ProductVersion = 1.0.3.0 >Process failed to respond; forcing abrupt termination... >Exit code: 1 Time: 74.05
  5. you declared $iVars = CheckInfo instead of $lVars = CheckInfo hence the error
  6. ==> Variable used without being declared.: If $iVars[0] = $rVars[0] And $iVars[1] <> $rVars[1] Then If ^ ERROR
  7. ==> Expected a "=" operator in assignment statement.: $pVals[2] = [$pName, $pVer] $pVals^ ERROR
  8. I created the file and entered 1.0.2.2 now i get VER=1.0.2.2 twice Then the error: "C:\Users\username\Desktop\MSIGetVer.au3" (23) : ==> The requested action with this object has failed.: $oPropValue = $oRecords.StringData(2) $oPropValue = $oRecords^ ERROR >Exit code: 1 Time: 25.45
  9. Yes i get 2 msg boxes with "VER =" but they both are blank And i still get this "C:\Users\username\Desktop\MSIGetVer.au3" (23) : ==> The requested action with this object has failed.: $oPropValue = $oRecords.StringData(2) $oPropValue = $oRecords^ ERROR >Exit code: 1 Time: 21.4
  10. This, What do I do here? what do I modify in the script to ensure that i don't get the error. "C:\Users\username\Desktop\MSIGetVer.au3" (23) : ==> The requested action with this object has failed.:$oPropValue = $oRecords.StringData(2)$oPropValue = $oRecords^ ERROR
  11. $oPropValue = $oRecords.StringData(2) to $oPropValue = $oRecords.StringData(3) ?? 
  12. Sorry what? i don't understand it at all What do i change? While @error = 0 $oRecords = $oView.Fetch $oPropValue = $oRecords.StringData(2) $oPropName = $oRecords.StringData(1) If $oPropName <> "" Then $oCount += 1 ConsoleWrite($oPropName & " = " & $oPropValue & @CRLF) If $oPropName = "ProductName" Then $pName = $oPropValue EndIf If $oPropName = "ProductVersion" Then $pVer = $oPropValue EndIf If $pName <> "" And $pVer <> 0 Then $oPropName = "" If $pName = "MatrixCodebase.msi" And $pVer <> FileReadLine(FileOpen("A:\U_A\U_W\C_NonFiledFiles\GetOfficePBVersion.txt"), 1) Then CloseRunningOfficePrograms() InstallMatrixCodeBase() EndIf EndIf EndIf WEnd
  13. Your script is giving me an error. >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\username\Desktop\MSIGetVer.au3" UpgradeCode = {050884C0-CB1A-46D5-8CCD-B35574D6F79C} ALLUSERS = 1 Manufacturer = Comapny Name ProductCode = {8B3DFDFF-D894-4A31-AA92-824729385F15} ProductLanguage = 1033 ProductName = Matrix Code Base ProductVersion = 1.0.3.0 SecureCustomProperties = WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED "C:\Users\username\Desktop\MSIGetVer.au3" (23) : ==> The requested action with this object has failed.: $oPropValue = $oRecords.StringData(2) $oPropValue = $oRecords^ ERROR >Exit code: 1 Time: 0.3434
  14. It's 32bit application. Maybe i am not being clear, the simplest option would be to just do this. If the shared folder path contains an *.msi file which is newer than a particular date then install the software, else exit Or If the shared folder path contains an *.msi file which is newer than a particular version then install the software. But when I use FileGetVersion on the MSI installer it gives me 0.0.0.0 which is sad as it would be much easier to do it this way i think. What do you think?
  15. What if my MSI does not have an uninstaller information? i've looked in the registry file and couldn't find the GUID of the program we install. The script is half baked right now. doesn't do all of the things i want it to do and thats where i am stuck and need help. That is a great option, but I am not sure how I can use this reason being. We deploy every few weeks and it would seem like all the script does is gets the version of the package installed. How do I get it to see if the version for ex. is newer than 1.0.1.0 then run the install option if its older or equals to 1.0.1.0 it should do nothing.
  16. Hi, So I am trying to create a script to run on all computers on the network that will periodically check for a new version of the program installer (MSI) and if it exists it will start the setup which should uninstall / upgrade the existing version. So far I have is this: #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $user = "DomainAdmin" $pass = "Password" $domain = "Domain" ; this below script was taken from one of the forum posts I forgot who's it was but if I run into it again i'll give an honorable mention to the creator of the script GetMSIDetails() $sMSI = FileOpenDialog("MSI Properties", @ScriptDir, "Windows Installer Files (*.msi)") ;here i would like to specify a path rather than for it to get me a dialog box to browse the msi file. $oInstaller = ObjCreate("WindowsInstaller.Installer") $oDB = $oInstaller.OpenDataBase($sMSI, 0) $oView = $oDB.OpenView("SELECT Property,Value FROM Property") $oView.Execute() $oCount = 0 While @error = 0 $oRecords = $oView.Fetch $oPropValue = $oRecords.StringData(2) $oPropName = $oRecords.StringData(1) If $oPropName <> "" Then $oCount += 1 ConsoleWrite($oPropName & " = " & $oPropValue & @CRLF) EndIf WEnd ; The only thing I want the above to get is Product Name & Product Version. Product name to only match if its our software file name (e.g. MatrixCodebase.msi) and Production Version so that the version is greater than say e.g. 1.0.3.0 so if i place a new file in there and its version is 1.0.4.0 then it will run the rest of the script if not it will exit Local $DisplayMsgBox = MsgBox ($MB_YESNO, "Release components", "****Some Text***** Do you want to deploy? Press 'Yes' to Continue, Or press 'No' to Exit") Select Case $DisplayMsgBox = 6 ;Yes CloseRunningOfficePrograms() Sleep (1000) ;UninstallMatrixCodeBase() Sleep (1000) ;InstallMatrixCodeBase() Case $DisplayMsgBox = 7 ;No Exit EndSelect Func CloseRunningOfficePrograms() If ProcessExists("WINWORD.EXE") Then ProcessClose ("WINWORD.EXE") If ProcessExists ("EXCEL.EXE") Then ProcessClose ("EXCEL.EXE") If ProcessExists ("OUTLOOK.EXE") Then ProcessClose ("OUTLOOK.EXE") If ProcessExists("VISIO.EXE") Then ProcessClose ("VISIO.EXE") If ProcessExists ("POWERPNT.EXE") Then ProcessClose ("POWERPNT.EXE") EndIf EndFunc Func InstallMatrixCodeBase() FileCopy("*\*\MatrixCodeBase.msi", "C:\Install") RunAsWait($user, $domain, $pass, 0,"msiexec /i C:\Install\MatrixCodeBase.msi /passive") FileDelete("*\*\MatrixCodeBase.msi") EndFunc
  17. Hi, Thanks it looks like though we are gonna go for a pull rather than using this push script. as we really want a single step install of our code base. So I am going to create a new post for that. Thanks for all your efforts it really helped me get close to a solution although I didn't get to implement it due to the different direction the company wants me to work on.
  18. Hi, I need help with the following. I am creating a script that displays a GUI for selection, I want the user to have the option of pressing Yes/No to confirm whether he/she wants to select that checkbox, If he/she presses yes then select if they press No then unselect. and the unselect is what i am not able to get to work. Can someone help me finalize this? #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> SelectComputer() Func SelectComputer() Local $hGUI = GUICreate("Select Computer", 300, 300) Opt("GUICoordMode", 0) ;1=absolute, 0=relative, 2=cell Local $idCheckbox1 = GUICtrlCreateCheckbox("022", 10, 10) Local $idCheckbox2 = GUICtrlCreateCheckbox("023", -1, 25) Local $idCheckbox3 = GUICtrlCreateCheckbox("024", -1, 25) Local $idCheckbox4 = GUICtrlCreateCheckbox("025", -1, 25) Local $idCheckbox5 = GUICtrlCreateCheckbox("027", -1, 25) Local $idCheckbox6 = GUICtrlCreateCheckbox("080", -1, 25) Local $idCheckbox7 = GUICtrlCreateCheckbox("113", -1, 25) Local $idCheckbox8 = GUICtrlCreateCheckbox("114", -1, 25) Local $idCheckbox9 = GUICtrlCreateCheckbox("116", -1, 25) Local $idCheckbox10 = GUICtrlCreateCheckbox("119", -1, 25) Local $idButton_Insert = GUICtrlCreateButton("Done", 150, 10) Local $idButton_Close = GUICtrlCreateButton("Close", 50, 0) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idCheckbox1 If _IsChecked($idCheckbox1) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 022", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No _IsUnChecked($idCheckbox1) EndSelect Else EndIf Case $idCheckbox2 If _IsChecked($idCheckbox2) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 023", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox3 If _IsChecked($idCheckbox3) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 024", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox4 If _IsChecked($idCheckbox4) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 025", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox5 If _IsChecked($idCheckbox5) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 027", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox6 If _IsChecked($idCheckbox6) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 080", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox7 If _IsChecked($idCheckbox7) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 113", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox8 If _IsChecked($idCheckbox8) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 114", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox9 If _IsChecked($idCheckbox9) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 116", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf Case $idCheckbox10 If _IsChecked($idCheckbox10) Then MsgBox($MB_YESNO, "", "Do you want to run the procedure over 119", 0, $hGUI) Select Case MsgBox = 6 ;Yes ;Run the procedure Case MsgBox = 7 ;No EndSelect Else ;If uncheck what should it do? EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _IsUnChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_UNCHECKED EndFunc ;==>_IsUnChecked
  19. Thank you @Bert That was a better option, I created a simple script that calls the other script - task done!
  20. Hidden is false as you can see in the XML code i added in the post.
  21. I am using the following script to restart computers at a specific time each day using Scheduled Task to create the event that would call the Script (Compiled .exe) #include <AutoItConstants.au3> #include <Misc.au3> #NoTrayIcon ;Begin Script Local $L_V_Scalar_Variant_Message = "This computer will restart in the next 2 minutes; save  all open documents immediately!" SplashTextOn("Restart Computer", $L_V_Scalar_Variant_Message, -1, -1, -1, -1, $DLG_TEXTLEFT, "", 24) Sleep(120000) ;120 seconds M_S_Restart() SplashOff() Func M_S_Restart() Shutdown(6) EndFunc When i run the script by double clicking on the exe it just works fine. Now i've added the complied script to Scheduled Task and set it to run daily at 4 am. User should be notified, if they are logged in or in locked state. but apparently the user doesnot get any notification and the computer is restarted which is a big problem, as their work is not saved. I am attaching the XML code for the Task. <?xml version="1.0" encoding="UTF-16"?> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Description>Restart computer daily at 4AM</Description> <URI>\U_A_A_WindowsRestartCore</URI> </RegistrationInfo> <Triggers> <CalendarTrigger> <StartBoundary>2019-03-08T04:00:00+00:00</StartBoundary> <Enabled>true</Enabled> <ScheduleByDay> <DaysInterval>1</DaysInterval> </ScheduleByDay> </CalendarTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-21-209663586-3969970584-2577160918-9632</UserId> <LogonType>InteractiveToken</LogonType> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <Duration>PT10M</Duration> <WaitTimeout>PT1H</WaitTimeout> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>C:\U_BayVL00\Programs\U_A_A_WindowsRestartCore.exe</Command> </Exec> </Actions> </Task> Any solution?
  22. Can you help code that into my existing script as mentioned in the first post? I didn't understand your script at all to use it in my code.
  23. Well that is not really a problem, i can distribute it easily using Group Policy > Computer Configuration > Preferences > Windows Settings > Files Here i usually place in the AutoIT compiled .exe's to copy over to each local computer.
  24. Currently the problem is 1. running the above script on multiple remote computers on the network from a single computer 2. Calling the following Func CloseRunningOfficePrograms() ,Func UninstallMatrixCodeBase() & Func InstallMatrixCodeBase() on the remote computer.
×
×
  • Create New...