ChromeFan Posted September 4, 2008 Share Posted September 4, 2008 can i restrict my script not to run from @HomeDrive (commonly c:\ Drive) ? like from Desktop, Documents folder, ProgramFiles or any other directory which is in C:\. but it should always work if the path is D:\ or D:\New Folder\Set. 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 Link to comment Share on other sites More sharing options...
Prab Posted September 4, 2008 Share Posted September 4, 2008 How about this? If StringLeft(@ScriptDir, 2) = @HomeDrive Then MsgBox(0,"", "Running from home drive") Exit EndIf MsgBox(0,"", "Not running from home drive") FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
ChromeFan Posted September 4, 2008 Author Share Posted September 4, 2008 How about this? If StringLeft(@ScriptDir, 2) = @HomeDrive Then MsgBox(0,"", "Running from home drive") Exit EndIf MsgBox(0,"", "Not running from home drive")nice idea, but what if i only want to restrict Program Files directory only? i have just changed my idea! 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 Link to comment Share on other sites More sharing options...
spudw2k Posted September 4, 2008 Share Posted September 4, 2008 If StringInstr(@ScriptDir, "C:\Program Files") Then MsgBox(0,"", "Running from C:\Program Files") Exit EndIf MsgBox(0,"", "Not running from C:\Program Files") Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Prab Posted September 4, 2008 Share Posted September 4, 2008 (edited) Use the same idea, but check out the macro @ProgramFilesDir. Edit: oops beaten to it, but I would still use the macro. (Program Files dir may not always be C:\Program Files) Edited September 4, 2008 by Prab FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
ChromeFan Posted September 4, 2008 Author Share Posted September 4, 2008 Use the same idea, but check out the macro @ProgramFilesDir.Edit: oops beaten to it, but I would still use the macro. (Program Files dir may not always be C:\Program Files)it will not work if the file is running fromC:\Program Files\MY FOLDERC:\Program Files\ETC\1234C:\Program Files\New Directory\First Folderit will only work if the file is running from onlyC:\Program Files\C:\Program Fileswhat should i do now? 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 Link to comment Share on other sites More sharing options...
Prab Posted September 4, 2008 Share Posted September 4, 2008 If not StringInstr(@ScriptDir, @ProgramFilesDir) Then MsgBox(0,"", "Not running from inside Program Files") Exit EndIf MsgBox(0,"", "Runing from " & @ScriptDir & "which is inside" & @ProgramFilesDir) This program has a small bug that I will leave for you to find. It should never happen in real life, but as a programmer, you should learn to watch out for this type of bug. FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
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