Jump to content

FileExist on Server or not ( if & else )


Recommended Posts

#include <UpdateGui.au3>

IF FileExist $datei = FileOpen("http://***/download/chat_offline.txt", 0)
if $x = FileReadLine($datei, 510)
Then
msgbox(0, "Server Offline", $x)
else
$datei1 = FileOpen("http://***/downloader/info.txt", 0)
If
$x1 = FileReadLine($datei1, 510)
Then
msgbox(0, "Server Online", $x1)
EndIf
;If $Info = then
;MsgBox(0,"Information" & $text)
;Exit
;EndIf


$sDataTextPathOnServer = "http://****/downloader/data.txt"
$sFilePathOnServer = "http://****/downloader/"
$sServerUrl = "****.de"
$sWindowTitel = "**** Downloader"

_CreateUpdateGUI($sWindowTitel,$sServerUrl,$sDataTextPathOnServer, $sFilePathOnServer)

it dont know what i make

its all wrong

when the server is offline then he should tell me the MSG Box Server Offline an exit

but is it online then the should tell me msg box Server online an open my downloader

i need help please

i`m sorry for my bad english i try it ^^

Link to comment
Share on other sites

That code is pretty badly written. But here is a cleaned up version that will at least display the message boxes correctly, after that you can at least be sure that things are formatted correctly as far as this piece of code goes.

#include <UpdateGui.au3>

$datei = FileOpen("http://***/download/chat_offline.txt", 0)
If $datei > 0 Then
    $x = FileReadLine($datei, 510)
    If $x > 0 Then
        MsgBox(0, "Server Offline", $x)
    Else
        $x1 = FileReadLine($datei, 510)
        If $x1 > 0 Then
            MsgBox(0, "Server Online", $x1)
        EndIf

        $sDataTextPathOnServer = "http://****/downloader/data.txt"
        $sFilePathOnServer = "http://****/downloader/"
        $sServerUrl = "****.de"
        $sWindowTitel = "**** Downloader"

        _CreateUpdateGUI($sWindowTitel, $sServerUrl, $sDataTextPathOnServer, $sFilePathOnServer)
    EndIf
Else
    MsgBox(0, "Server Offline", $datei)
EndIf

I'd suggest looking in the help file for how to use If...Else...Then statements because what you wrote wouldn't ever run as is.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

jeah thankssss

but i push F5 and this here comes

C:\Programme\AutoIt3\Include\UpdateGui.au3(98,27) : ERROR: undefined macro.
                        While @InetGetActive
                        ~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Include\UpdateGui.au3(99,56) : ERROR: undefined macro.
                            GUICtrlSetData($pDlProgress, (@InetGetBytesRead /
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Include\UpdateGui.au3(100,102) : ERROR: undefined macro.
                            GUICtrlSetData($pLabelInfo, "Download: " & $sNameSelectedFile & " - " & Int(@InetGetBytesRead /
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programme\AutoIt3\Include\UpdateGui.au3(100,189) : ERROR: undefined macro.
                            GUICtrlSetData($pLabelInfo, "Download: " & $sNameSelectedFile & " - " & Int(@InetGetBytesRead / 1000) & "/" & $iDataFileSize[$iTempIndex[1] + 1] & " KB - " & Int((@InetGetBytesRead /
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

the attachement is the UpdateGui

but what is wrong`?

UpdateGui.au3

Edited by Darki
Link to comment
Share on other sites

Those macros have been replaced, from the helpfile

InetGet("abort"), @InetGetActive and @InetGetBytesRead have been removed. The following list shows the new functions used to access the old behavior:

InetGet("abort") - Calling the new InetClose() function with a handle returned from InetGet() will abort a download.

@InetGetActive - Calling the new InetGetInfo() function with no parameters returns a count of active downloads.

@InetGetBytesRead - Calling the new InetGetInfo() function with a handle returned from InetGet()will return the bytes read (and more) for a download.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
 Share

  • Recently Browsing   0 members

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