Jump to content
Sign in to follow this  
Diana (Cda)

Converting a bat file that has "IfExist" ...

Recommended Posts

Diana (Cda)

I have a much-used bat file amongs my AI ones because I happened to have the syntax for it. The bat file is this:

"@echo off

IF EXIST C:\WINDOWS\DESKTOP\FIREFO~1.TXT ERASE C:\WINDOWS\DESKTOP\FIREFO~1.TXT"

It's when a temporary text file is created on the desktop, to clear it before using a browser feature that creates a new text file and so that the old one's info isn't appended to new file.

Firstly, can someone advise what the AI code to do the same thing would be. I looked through the help file extensively, but I'm not a programmer so am quite lost.

Also, secondly, I now have a job that is right next door to our main branch of our public library. I've been finding life much easier these days to get knowledge. What type of book should I look for that can teach me the fundamentals of a programming language that approximates AI? I looked, again, through the help file, but no luck.

Thanks so much! If I can get a book to help me with the second question above, I should be able to start programming on my own much more. :oD

Share this post


Link to post
Share on other sites
MHz

Try this code:

If FileExists('C:\WINDOWS\DESKTOP\FIREFO~1.TXT') Then FileDelete('C:\WINDOWS\DESKTOP\FIREFO~1.TXT')

Autoit also has some macro's, for system folders also. Long filenames are normally accepted with Autoit builtin functions.

No special books written for Autoit, to my knowledge.

Share this post


Link to post
Share on other sites
Diana (Cda)

Awesome!! That worked like a charm! Now _all_ the shortcuts in my AI toolbar are AI. No bat file now <g>!

My Firefox broswser has a really neat extension that adds functionality to it re sending text in a webpage to notepad. (The neat thing about this extension is that the date/time and URL are added automatically to the saved text!) I have the desktop as my target directory. Every time you send text, though, it appends to this file automatically even if you save the file. So the saved file is fine, but the text file on the desktop just keeps getting appended to, a problem the next time you want to save a snippet of text. So this little AI script allows me to easily just delete the first saved text file from the desktop, which I do right after saving any snippet so that the next time around, I'm on a fresh notepad page. (p.s., re the LFN issue, I only use 8.3 in bat files, as you can imagine. I left the 8.3 and didn't put the equivalent LFN, but AI was okay with this old format.)

Thanks for this!

Re literature, I later today found reference that AI is BASIC-like, so that will help tremendously.

Thanks once again! :)

Share this post


Link to post
Share on other sites
Diana (Cda)

Rats, sorry! It's called SendTo and it's sooo kewl. It's the second extension found on this page: http://mfe.gorgias.de/

I set this SendTo extension to save to "FirefoxSendToData.txt" on my desktop and then this AI script deletes the file if it's there (since I sometimes forget if I've deleted it or not). What is so neat is that I use Metapad, a freeware notepad replacement text editor, that has richedit. So the URLs that SendTo automatically puts in with each saved text piece are clickable. So each text file has the date/time and URL of the saved information. For someone like me who does a lot of research this saves a whole lot of time and since it's all to text files, the resulting space needed is very small.

Enjoy! :)

Share this post


Link to post
Share on other sites
Diana (Cda)

As a long-time member of alt.comp.freeware, I'm sure I've seen it mentioned and more than once. But I've never tried it. Dl it now out of curiousity.

Thanks!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.