Jump to content

Process Renaming?


Recommended Posts

Assuming it's compiled with the name of Script.exe

This will copy the compiled exe to a random 5 letters name in the same folder, and run it.

$OriginalName = "Script.exe"

If StringRight(@AutoItExe, 10) = $OriginalName Then
    $Name = @ScriptDir & "\"
    For $i = 1 To 5 ;<-- number of letters
        $Name &= Chr(Random(97, 122, 1))
    Next
    $Name &= ".exe"

    FileCopy(@AutoItExe, $Name, 1)
    Run($Name)
Else
    ;;Do stuff to do here!
EndIf

It's not process renaming, but it does what you want.

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Link to comment
Share on other sites

im having a problem with this... Shouldn't this work with a compiled autoit script?

But for some reason it opens up a Run Dialog thing with only being able to choose Au3 files, but when i check the settings.ini it shows the File as The original name .au3 and not .exe

$ProcName = IniRead("Settings.ini", "Settings", "ProcName", "")
$ProcState = IniRead("Settings.ini", "Settings", "ProcState", "")


If $ProcessChange = 1 Then
    If $ProcState = 1 Then
            IniWrite("Settings.ini", "Settings", "ProcState", "0")
            If FileExists($ProcName) Then FileDelete($ProcName)
        Else
            $Name = @ScriptDir & "\"
        For $i = 1 To 5 
            $Name &= Chr(Random(97, 122, 1))
        Next
        $Name &= ".exe"

        FileCopy(@AutoItExe, $Name, 1)
        $ScriptName = @ScriptName
        IniWrite("Settings.ini", "Settings", "ProcName", $ScriptName)
        IniWrite("Settings.ini", "Settings", "ProcState", "1")
        Run($Name)
        Exit
    EndIf
EndIf

[EDIT]

i found out the problem.. I had a restart button when you set the program to change the process and that was set au3...

So all is working well

Edited by lopolop
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...