ChromeFan Posted September 6, 2008 Posted September 6, 2008 (edited) First: can i rename the running exe itself? Second: i want my script not to run if it was renamed. i have read about @AutoItExe , @ScriptFullPath and related macros but thay include the path and i can't restrict my script to run if it was renamed. Edited September 6, 2008 by ChromeFan Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
ChromeFan Posted September 6, 2008 Author Posted September 6, 2008 (edited) -.- Edited September 6, 2008 by ChromeFan Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
ChromeFan Posted September 6, 2008 Author Posted September 6, 2008 use this macro: @ScriptFullPathread my post again i already tried to use @ScriptFullPath Macro but it included the exe name also, please help me by giving a example to let me know the correct if i am doing something wrong. thanks for the quick reply! Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
oMBRa Posted September 6, 2008 Posted September 6, 2008 (edited) Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName for Your first question try this: $OldName = @ScriptFullPath $NewName = "yourname.exe" FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName) FileDelete($OldName) Edited September 6, 2008 by oMBra
ChromeFan Posted September 6, 2008 Author Posted September 6, 2008 Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName for Your first question try this: $OldName = @ScriptFullPath $NewName = "yourname.exe" FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName) FileDelete($OldName)oÝ÷ Ûú®¢×¢víÁ©í¶¬§¶ØZ¶l¬r¸©¶ÈhºWg¢Úî'â¶++zv¦yÛh²¶§Ilyú+{¦¦WéÚê'±z+ {±y©Ýö§ÊÞéÚë"¶Ú(×±zØ^l¬r¸©¶ÈhºWg¢Ü(®KaDZjjezÈhÂËajضW¢²»§)à~º&>º ©W¬¶§Ü"X"½æ¦zËæ§uÉh±ê-êðÇ¢·¥»§j¢Û¶nË^²Ö®¶sdgVæ2FW7B¤bæ÷B7G&ætç7G"67&DF"Â&öw&ÔfÆW4F"FVà FW7B¤VÇ6P ×6t&÷ÂgV÷C²gV÷C²ÂgV÷Cµ'Væærg&öÒgV÷C²fײ67&DF"fײgV÷C²v62ç6FRgV÷C²fײ&öw&ÔfÆW4F"¢W@¤VæD`¤VæDgVæ0§FW7B i just want to restrict my script don't work if it is renamed or it's name is Updated. Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
oMBRa Posted September 6, 2008 Posted September 6, 2008 U can do: $MyName = "New.exe" If @ScriptName = $MyName Then ;run the script Else Exit EndIf
ChromeFan Posted September 6, 2008 Author Posted September 6, 2008 U can do: $MyName = "New.exe" If @ScriptName = $MyName Then ;run the script Else Exit EndIf but how can i rename the running exe? Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
oMBRa Posted September 6, 2008 Posted September 6, 2008 (edited) Srry I Dont understand your second question... do u need to get only the name of the script? if yes use @ScriptName for Your first question try this: $OldName = @ScriptFullPath $NewName = "yourname.exe" ; the name u want to set FileMove(@ScriptFullPath, @ScriptDir & "\" & $NewName) FileDelete($OldName) this is the code a posted before... use it Edited September 6, 2008 by oMBra
ChromeFan Posted September 6, 2008 Author Posted September 6, 2008 this is the code a posted before... use itit is not working if the file itself is running. Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
Bowmore Posted September 6, 2008 Posted September 6, 2008 it is not working if the file itself is running.It is not possible.Window will not let you rename a running process. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
komalo Posted September 6, 2008 Posted September 6, 2008 (edited) well if your "renaming" is in the first line of the script then you can do it like this $OldName = @ScriptFullPath $NewName = "yourname.exe"; the name u want to set FileCopy(@ScriptFullPath, @ScriptDir & "\" & $NewName) Run(@ScriptDir & "\" & $NewName) ProcessClose(@ScriptName) FileDelete($OldName) Edited September 6, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]
mikiutama Posted September 7, 2008 Posted September 7, 2008 It is not possible. Window will not let you rename a running process. yes, the file can be renamed while its running... i just did.. but it cannot be deleted... try it yourself... run the file i attached then drag that file into list view and click "Start Shredding" you'll see... or if you dont trust the .exe, here's the source... (the file is working but not yet finished...)
Bowmore Posted September 7, 2008 Posted September 7, 2008 yes, the file can be renamed while its running... i just did..but it cannot be deleted...My mistake. You are correct the disk file can be renamed. The usual AutoIt method of renaming files FileMove() will not work but using the dos RENAME command will. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
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