Jump to content

Some problem about update software


kid1232
 Share

Recommended Posts

First, SR about my english, its really bad. so i hope you can understand

I done my update function, now before update, i use Run() to run setup file

My problem is in setup file that i have to kill process of my software is running (i have idea about set process no change when name change (F2) then processclose )

So. My problem is kill process (anyone can change name -> change process name), or make it cannot change name

Are you have any idea for me?

Thanks a lot :(

Link to comment
Share on other sites

Maybe you can pass the PID as a command line parameter in your Run() call, or set the PID in a environment variable.

In your setup, you will have to get the command line parameter or environment variable, and kill the process using the PID.

It's just an idea, there is probably an easier way...

Link to comment
Share on other sites

Well,

 - To get the PID of your running script, you can use @AutoItPID : it's the Process Identifier of a program, witch is uniq.

 - To pass a parameter in the command line when calling your setup, you can do Run("setup.exe PID=" & @AutoItPID)

 - To set an environment variable, just do EnvSet("MyPIP", @AutoItPID)

After that, you wil have to get the value in our setup, but I don't know what kind of setup it is (AutoIt, installshield, inno...?)

If the setup is an AutoIt script, in can get the value like this :

; For command line parameter
If $Cmdine[0] = 1 Then
  If StringInStr($Cmdine[1], "PID=") Then
    $PID = StringRegExpReplace($Cmdine[1], ".*PID=(.*)", "$1")
    ProcessClose($PID)
  EndIf
EndIf

; For environement variable
$PID = EnGet("MyPID")
If Number($PID) <> 0 Then ProcessClose($PID)

Is it good ?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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