bordomavi Posted August 14, 2013 Share Posted August 14, 2013 FileInstall("SPTDinst-x86.exe", @TempDir & "\SPTDinst-x86.exe", 1) If Not FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") Then If @OSArch = "X86" Then ShellExecuteWait(@TempDir & "\SPTDinst-x86.exe", 'add') While 1 If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") Then ProcessClose("SPTDinst-x86.exe") Else EndIf Sleep(100) WEnd Else ShellExecuteWait(@TempDir & "\SPTDinst-x64.exe", 'add') While 1 If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") Then ProcessClose("SPTDinst-x64.exe") Else EndIf Sleep(100) WEnd EndIf Else MsgBox(0x00000010, "Error", "SPTD 1.83 is Allready on your pc", 5) EndIf FileDelete(@TempDir & "\SPTDinst-x86.exe") i want processclose "SPTDinst-x86.exe" when "sptd.sys" create in "System32Drivers" so i use while code but it does not work. Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 some body help me pls Link to comment Share on other sites More sharing options...
guinness Posted August 14, 2013 Share Posted August 14, 2013 Please don't bump less than 24 hours. People help because they want to and it's free support, so what more do you want. UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 Please don't bump less than 24 hours. People help because they want to and it's free support, so what more do you want. ok sory Link to comment Share on other sites More sharing options...
ripdad Posted August 14, 2013 Share Posted August 14, 2013 (edited) A few things: 1) Why would you need to force-close the install? 2) How would you exit your loop after ProcessClose? I re-arranged your code a little... Local $sFile, $sPath If FileExists(@WindowsDir & '\System32\Drivers\sptd.sys') Then MsgBox(0x00000010, 'Error', 'SPTD 1.83 is Allready on your pc', 5) Else If @OSArch = 'X86' Then $sPath = @TempDir & '\SPTDinst-x86.exe' $sFile = 'SPTDinst-x86.exe' Else $sPath = @TempDir & '\SPTDinst-x64.exe' $sFile = 'SPTDinst-x64.exe' EndIf FileInstall($sFile, $sPath, 1) ShellExecuteWait($sPath, 'add'); <--- you can't go to the next line until this finishes ProcessClose($sFile) FileDelete($sPath) EndIf Edited August 14, 2013 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013  A few things: 1) Why would you need to force-close the install? 2) How would you exit your loop after ProcessClose? I re-arranged your code a little... Local $sFile, $sPath If FileExists(@WindowsDir & '\System32\Drivers\sptd.sys') Then MsgBox(0x00000010, 'Error', 'SPTD 1.83 is Allready on your pc', 5) Else If @OSArch = 'X86' Then $sPath = @TempDir & '\SPTDinst-x86.exe' $sFile = 'SPTDinst-x86.exe' Else $sPath = @TempDir & '\SPTDinst-x64.exe' $sFile = 'SPTDinst-x64.exe' EndIf FileInstall($sFile, $sPath, 1) ShellExecuteWait($sPath, 'add'); <--- you can't go to the next line until this finishes ProcessClose($sFile) FileDelete($sPath) EndIf Because i want close "Finish installation window"  after install. and your code is not working. it not processclose SPTDinst-x86.exe Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 (edited) you told "you can't go to the next line until this finishes" i know this. so i wrote : While 1 If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") Then ProcessClose("SPTDinst-x86.exe") Else EndIf Sleep(100) WEnd but it didn't work too Edited August 14, 2013 by bordomavi Link to comment Share on other sites More sharing options...
FireFox Posted August 14, 2013 Share Posted August 14, 2013 (edited) Hi,Since you're using the ShellExecuteWait the proccess can not exist after the function, or it launches another instance of itself?Br, FireFox. Edited August 14, 2013 by FireFox Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 (edited) Hi, Since you're using the ShellExecuteWait the proccess can not exist after the function, or it launches another instance of itself? Br, FireFox. hi. when i use shellexecutewait with silent parameter it says "fisihed installation" but SPTDinst-x86.exe running already so it is can't run nex line. so i build while code. i wrote previous comments. Edited August 14, 2013 by bordomavi Link to comment Share on other sites More sharing options...
ripdad Posted August 14, 2013 Share Posted August 14, 2013 (edited) you told "you can't go to the next line until this finishes" i know this. so i wrote : While 1 If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") Then ProcessClose("SPTDinst-x86.exe") Else EndIf Sleep(100) WEnd but it didn't work too  But you see... it's stuck there (at that line) until the program exits with ShellExecuteWait. Here, try this... Local $sFile, $sPath, $nCount = 0, $sSptd = @WindowsDir & '\System32\Drivers\sptd.sys' If FileExists($sSptd) Then MsgBox(0x00000010, 'Error', 'SPTD 1.83 is Allready on your pc', 5) Else If @OSArch = 'X86' Then $sPath = @TempDir & '\SPTDinst-x86.exe' $sFile = 'SPTDinst-x86.exe' Else $sPath = @TempDir & '\SPTDinst-x64.exe' $sFile = 'SPTDinst-x64.exe' EndIf FileInstall($sFile, $sPath, 1) ShellExecute($sPath, 'add') While 1 Sleep(1000) If FileExists($sSptd) Then ProcessClose($sFile) FileDelete($sPath) ExitLoop EndIf $nCount += 1 If $nCount > 5 Then; <-- 5 second failsafe ExitLoop EndIf WEnd EndIf edit: silly editor - fixed endif Edited August 14, 2013 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 But you see... it's stuck there (at that line) until the program exits with ShellExecuteWait. Here, try this... Local $sFile, $sPath, $nCount = 0, $sSptd = @WindowsDir & '\System32\Drivers\sptd.sys' If FileExists($sSptd) Then MsgBox(0x00000010, 'Error', 'SPTD 1.83 is Allready on your pc', 5) Else If @OSArch = 'X86' Then $sPath = @TempDir & '\SPTDinst-x86.exe' $sFile = 'SPTDinst-x86.exe' Else $sPath = @TempDir & '\SPTDinst-x64.exe' $sFile = 'SPTDinst-x64.exe' EndIf FileInstall($sFile, $sPath, 1) ShellExecute($sPath, 'add') While 1 Sleep(1000) If FileExists($sSptd) Then ProcessClose($sFile) FileDelete($sPath) ExitLoop EndIf $nCount += 1 If $nCount > 5 Then; <-- 5 second failsafe ExitLoop EndIf WEnd EndIf edit: silly editor - fixed endif yes it is working but i have a new problem. sptd.sys created in windowsdir and processclose worked but program didnt install. because sptd.sys is creating in windowsdir before insalling program  Link to comment Share on other sites More sharing options...
FireFox Posted August 14, 2013 Share Posted August 14, 2013 (edited) hi. when i use shellexecutewait with silent parameter it says "fisihed installation" but SPTDinst-x86.exe running already so it is can't run nex line. so i build while code. i wrote previous comments.This is where you don't understand that the ShellExecuteWait function won't complete until the target application finishes so the next lines can't be executed. #include <Constants.au3> If @OSArch = "X86" Then FileInstall("SPTDinst-x86.exe", @TempDir & "\SPTDinst-x86.exe", 1) Else FileInstall("SPTDinst-x64.exe", @TempDir & "\SPTDinst-x64.exe", 1) EndIf If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 1 Then ;if the driver exists Exit MsgBox(BitOR($MB_ICONHAND, $MB_OK), "Error", "SPTD 1.83 is Allready on your pc", 5) EndIf ShellExecute(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe", 'add') ;launch the setup While FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 0 ;wait for the driver to exist Sleep(100) WEnd FileDelete(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe")Edit: Added indents.Br, FireFox. Edited August 14, 2013 by FireFox Link to comment Share on other sites More sharing options...
ripdad Posted August 14, 2013 Share Posted August 14, 2013 I'm sure there is a better way. Again, why do you need to force-close the install? Is it waiting for a "Ok" button to be pushed? "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 (edited) This is where you don't understand that the ShellExecuteWait function won't complete until the target application finishes so the next lines can't be executed. Â #include <Constants.au3> If @OSArch = "X86" Then FileInstall("SPTDinst-x86.exe", @TempDir & "\SPTDinst-x86.exe", 1) Else FileInstall("SPTDinst-x64.exe", @TempDir & "\SPTDinst-x64.exe", 1) EndIf If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 1 Then ;if the driver exists Exit MsgBox(BitOR($MB_ICONHAND, $MB_OK), "Error", "SPTD 1.83 is Allready on your pc", 5) EndIf ShellExecute(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe", 'add') ;launch the setup While FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 0 ;wait for the driver to exist Sleep(100) WEnd FileDelete(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe") Edit: Added indents. Br, FireFox. Â it stops this window it is like "installation finished" Edited August 14, 2013 by bordomavi Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 I'm sure there is a better way. Again, why do you need to force-close the install? Is it waiting for a "Ok" button to be pushed? yes it is waiting for it. but i want it full silent. Link to comment Share on other sites More sharing options...
FireFox Posted August 14, 2013 Share Posted August 14, 2013 Try this : #include <Constants.au3> If @OSArch = "X86" Then FileInstall("SPTDinst-x86.exe", @TempDir & "\SPTDinst-x86.exe", 1) Else FileInstall("SPTDinst-x64.exe", @TempDir & "\SPTDinst-x64.exe", 1) EndIf If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 1 Then ;if the driver exists Exit MsgBox(BitOR($MB_ICONHAND, $MB_OK), "Error", "SPTD 1.83 is Allready on your pc", 5) EndIf ShellExecute(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe", 'add') ;launch the setup WinWait("SPTD setup V1.83 (C) 2004-2012 Duplex Secure Ltd") FileDelete(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe") Link to comment Share on other sites More sharing options...
FireFox Posted August 14, 2013 Share Posted August 14, 2013 (edited) If you want it full silent, the setup may have a silent parameter like /q or /silent. Edit: Try this : #include <Constants.au3> If @OSArch = "X86" Then FileInstall("SPTDinst-x86.exe", @TempDir & "\SPTDinst-x86.exe", 1) Else FileInstall("SPTDinst-x64.exe", @TempDir & "\SPTDinst-x64.exe", 1) EndIf If FileExists(@WindowsDir & "\System32\Drivers\sptd.sys") = 1 Then ;if the driver exists Exit MsgBox(BitOR($MB_ICONHAND, $MB_OK), "Error", "SPTD 1.83 is Allready on your pc", 5) EndIf ShellExecuteWait(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe", 'add /q') ;launch the setup FileDelete(@TempDir & "\SPTDinst-" & StringLower(@OSArch) & ".exe") Edited August 14, 2013 by FireFox Link to comment Share on other sites More sharing options...
ripdad Posted August 14, 2013 Share Posted August 14, 2013 Does it reboot after you push the button? "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 (edited) If you want it full silent, the setup may have a silent parameter like /q or /silent. it has not. only has 1 parameter and it is "add" or may be has but i dont know Edited August 14, 2013 by bordomavi Link to comment Share on other sites More sharing options...
bordomavi Posted August 14, 2013 Author Share Posted August 14, 2013 Does it reboot after you push the button? i want press ok button affter installation. but i couldnt it. so i built while code with processclose but it didnt work too 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