Jump to content
Sign in to follow this  
vi6ora

If FileExists() Then

Recommended Posts

vi6ora

Hi. I need help with a script i am making. I need the script to check if severel files exist and if they do delete them and install new ones

Func Launch()
If  FileExists(GuiCtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp") Then
    FileDelete(GuiCtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp") 
 Else 
     FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash01.bmp", GuiCtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp")

 EndIf   
 
 ;;
 If  FileExists (GuiCtrlRead($SavePath) &"\Textures\Loading\Splash02.bmp") Then
     FileDelete(GuiCtrlRead($SavePath) &"\Textures\Loading\Splash02.bmp") 
 Else
    FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash02.bmp", GuiCtrlRead($SavePath) & "\Textures\Loading\Splash02.bmp")
EndIf
 ;;
  If FileExists (GuiCtrlRead($SavePath) &"\Textures\Loading\Splash03.bmp") Then
     FileDelete(GuiCtrlRead($SavePath) &"\Textures\Loading\Splash03.bmp") 
 Else
    FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash03.bmp", GuiCtrlRead($SavePath) & "\Textures\Loading\Splash03.bmp")
EndIf
 ;;
  If  FileExists (GuiCtrlRead($SavePath) &"\Textures\Loading\Splash04.bmp") Then
     FileDelete(GuiCtrlRead($SavePath) &"\Textures\Loading\Splash04.bmp") 
 Else
    FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash04.bmp", GuiCtrlRead($SavePath) & "\Textures\Loading\Splash04.bmp")
EndIf
 ;;
     Run(GUICtrlRead($SavePath)&"\bin32\Aion.bin -ip:76.191.99.155 -ng")    
     If @error Then
    TrayTip( "Vitality Aion Error", "An error ocurred while starting vitality aion. " , 1)
EndIf
If ProcessExists("AION.bin") Then 
    TrayTip( "Vitality Aion Launched Successfully.", "Vitality Aion has been launched Successfully. " , 1)
EndIf   
EndFunc

The problem is that if they already exist the script deletes them. but then doesnt install them

Edited by vi6ora

Share this post


Link to post
Share on other sites
lordicast

Add it...

You made it so if the file exist delete but not install it, also its written to only install it if it doesnt exist.

Func Launch()
    If FileExists(GUICtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp") Then
        FileDelete(GUICtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp")
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash01.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp")
    Else
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash01.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash01.bmp")
    EndIf

    If FileExists(GUICtrlRead($SavePath) & "\Textures\Loading\Splash02.bmp") Then
        FileDelete(GUICtrlRead($SavePath) & "\Textures\Loading\Splash02.bmp")
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash02.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash02.bmp")
    Else
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash02.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash02.bmp")
    EndIf

    If FileExists(GUICtrlRead($SavePath) & "\Textures\Loading\Splash03.bmp") Then
        FileDelete(GUICtrlRead($SavePath) & "\Textures\Loading\Splash03.bmp")
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash03.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash03.bmp")
    Else
        FileInstall("D:\Games\NCsoft\Aion\Textures\Loading\Splash03.bmp", GUICtrlRead($SavePath) & "\Textures\Loading\Splash03.bmp")
    EndIf
EndFunc   ;==>Launch

[Cheeky]Comment[/Cheeky]

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.