Jump to content

[Resolved] If file doesn't exists?

Recommended Posts

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)
Link to comment
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! :)

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...