DonationCoder.com Software > Finished Programs
DONE: make script only work if not started from USB stick
(1/1)
brotherS:
Thanks to skrommel, I'm using a script that checks for the existence of a file:
--- ---IfNotExist,D:\data\program files\Autohotkey\daily\0815_%A_YYYY%-%A_MM%-%A_DD%.txt
If this file doesn't exist, it creates it and starts a process on my PC that I only want to run once a day. My problem: the script is also working when not only the file does not exist, but also when the path itself (D:\data\program files\Autohotkey\daily\) does not exist. So the process is also started when I run AutoHotkey from my USB stick on another PC.
What would be the best way to prevent this?
PhilKC:
Well, I don't 'do' AutoHotKey, but, surely it allows you to check for directories?
C# code:
if ((Directory.Exists("D:\\data\\program files\\Autohotkey\\daily")) && (! File.Exists("D:\\data\\program files\\Autohotkey\\daily\\" + The_Date + ".txt")))
{
Backup();
}
English code:
If the directory exists, but the file doesn't, backup...
Edit: IDEA! Put another file, "check.me" on the drive, and only run the backup if it finds that file AND not the other file...
PhilKC
brotherS:
Edit: IDEA! Put another file, "check.me" on the drive, and only run the backup if it finds that file AND not the other file...
-PhilKC (December 23, 2005, 05:31 PM)
--- End quote ---
I like the idea, this would easily allow several scripts to use it for this kind of detection too!
Let's see, what our local AHK master, skrommel, thinks about this :)
brotherS:
Works!
Script looks like this now:
--- ---#Persistent
IfExist,D:\data\program files\
SetTimer, X1, 800000
else
return
SetTitleMatchMode, 1
return
#Persistent
X1:
IfNotExist,D:\data\program files\Autohotkey\daily\0815_%A_YYYY%-%A_MM%-%A_DD%.txt
If WinExist("special title")
MsgBox, page already open
Else
{
Run,IExplore.exe http://www.whatever.bla
FileCopy,D:\data\program files\Autohotkey\daily\0815_info.txt,D:\data\program files\Autohotkey\daily\0815_%A_YYYY%-%A_MM%-%A_DD%.txt
}
Return
Navigation
[0] Message Index
Go to full version