Sign in to follow this  
Followers 0
Diana (Cda)

[Resolved] If file doesn't exists?

4 posts in this topic

#1 ·  Posted (edited)

I was so sure there was something like "If NotFileExists" then .... for those cases where we need to do a file operation _only_ if that file doesn't already exist. But I can't find anything in the help file nor is there anything in the forums; so I'm guessing (and hoping) it's just a case of not having the right terminology so my searches aren't turning up anything.

I need to create a shortcut to a script in the QuickLaunch folder _only_ if the shortcut isn't already there. Was wondering how to do that in terms of syntax.

Thanks! :)

Edited by Diana (Cda)

Share this post


Link to post
Share on other sites



If NOT FileExists()

Share this post


Link to post
Share on other sites

or

if FileExists("c:\test.txt") = 0 Then
    MsgBox(0,"","Thefile does not exist")
EndIf


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Thanks, guys! Just now, I stumbled upon the answer. I get it now. It just takes putting a NOT in front! Everything is simple once you know how.

Here's part of the script. It's quite a bit longer, but it's all the same thing, so just copying a part of it here:

; ----- USB flash drive.  Change the drive letter below whenever it changes when you're given a new computer.---------------
$PORTABLEdriveLetter = "E:\"
; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
; ===== Firefox Portable v2.0.0.3: ================================================================
If Not FileExists (@UserProfileDir & "\SendTo\Firefox Portable.lnk") Then FileCreateShortcut(@UserProfileDir & "\Favorites\01\0WXP\APP- Firefox Portable v2.0.0.3\FirefoxPortable.exe", @UserProfileDir & '\SendTo\Firefox Portable.lnk','','""')
; ===== Irfanview: ================================================================================
If Not FileExists (@UserProfileDir & "\SendTo\Irfanview.lnk") Then FileCreateShortcut($PORTABLEdriveLetter & "\APPS\IMAGE\img, Irfanview v3.85\APP- Irfanview v3.85\i_view32.exe", @UserProfileDir & '\SendTo\Irfanview.lnk','','""')

etc. ...

I used my recently learned syntax of creating a shortcut and it's really neat. Whenever I start a new contract, I'll not have to copy the shortcuts, then open the SendTo folder and paste, I'll just need to click on the script. And with my also recently learned knowledge of variables, just need to make the one small change at the top from "E" to whatever new drive letter is needed.

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  
Followers 0