Jump to content

Recommended Posts

Posted (edited)

hey guys i am trying to make a peice of code that stops the attached program from running if the program is run from the program files or windows directory

if @ScriptDir = @WindowsDir Then
    MsgBox(0, "Error", "Sorting in any parts of the Windows folder will cause the computer to cease function, Terminating Program")
    Exit
    Else
if @ScriptDir = @ProgramFilesDir Then
    MsgBox(0, "Error", "Sorting in any parts of the program files section will cause programs to cease functioning, Terminating Program")
    Exit
    Endif
    Endif

now the code works fine if the script is run from the program files and windows directory, however i wish to include all subdirectories within the windows and program files directories

thanks in advance

Edited by snowman533

Intermediate AutoIt/Autohotkey User

Posted

Simple :D

If StringLeft(@ScriptDir,StringLen(@WindowsDir))=@WindowsDir Or StringLeft(@ScriptDir,StringLen(@ProgramFilesDir))=@ProgramFilesDir Then Exit

:o

Broken link? PM me and I'll send you the file!

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
×
×
  • Create New...