Jump to content

Recommended Posts

Posted

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.

Posted

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (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 by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Posted

 

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

Posted (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 by FireFox
Posted (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 by bordomavi
Posted (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 by ripdad

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Posted

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 :( 

Posted (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 by FireFox
Posted

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

Posted (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"

138k.png

Edited by bordomavi
Posted

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.

Posted

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")
Posted (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 by FireFox
Posted

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

Posted (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 by bordomavi
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...