Jump to content

_Func error I can't figure out..


Msb12i
 Share

Recommended Posts

Hi guy's,

This is my second time I'm writing a script and this forum has a allot of smart guy's with helpfull hint en tricks. Learned allot since my first one.

 

I've used the information and bit's and pieces of scripts found on this forum to suit my need. (If I would steal and commercialise them I would be Mark Zuckerberg)

I would credit everyone but I didn't plan on asking help:sweating:, so I didn't include the creator's name in my script. For that, I am sorry.

 

Anyway I get the same error everytime => error.thumb.JPG.7cba780cf040cba1e6ea736e

 

The strange thing is that if I extract everything under _Func Nodownload() into a seperate script, it runs like a sharm...

 

According to the error, there is no Endfunc??? But as you can see there is an endfunc...

Even entered EndFunc _check1ok() to see if EndFunc could search for the function it belongs to. No luck(hey I'm still a noob)

 

Func _check1ok()
                     $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\1.xls")
                              EndFunc

 

Can't seem to figure this out...

 

If I delete func _check1ok () then it gives an error on Func _check2ok() (logicly because I copy, pasted them all ^_^)

 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <Excel.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>

If _Singleton("Downloader", 1) = 0 Then
   MsgBox($MB_SYSTEMMODAL, "Let op!", "Dit programma kan maar één keer geopend worden!")
   Exit

EndIf

Do
    $pass = InputBox ("Login", "Wachtwoord ingeven AUB","","*",175,120)
    If $pass <> "password" Then
        Exit
    EndIf
Until $pass == "password"


Opt("TrayMenuMode", 1)

$Form1              = GUICreate("Downloader", 400, 170, -1, -1)

$pb_File            = GUICtrlCreateProgress(30, 30, 300, 20, $PBS_SMOOTH)
$lbl_FilePercent    = GUICtrlCreateLabel("0 %", 335, 32, 35, 16, $SS_RIGHT)

$pb_Overall         = GUICtrlCreateProgress(30, 80, 300, 20, $PBS_SMOOTH)
$lbl_OverallPercent = GUICtrlCreateLabel("0 %", 335, 82, 35, 16, $SS_RIGHT)

$but_Download       = GUICtrlCreateButton("Download Starten", 45, 120, 125, 30)
$but_Download2    = GUICtrlCreateButton("Download Overslaan", 195, 120, 125, 30)



GUISetState(@SW_Show)

While 1

    $nMsg = GUIGetMsg()

    If $nMsg = $GUI_EVENT_CLOSE Then EXIT

    If $nMsg = $but_Download Then _Download()

    If $nMsg = $but_Download2 Then NoDownload()

WEnd


Func _Download()

    ; Disable the download button
    GUICtrlSetState($but_Download, $GUI_DISABLE)

    ; Reset total filesize to download
    $TotalToDownload = 0

    Dim $DownloadArray[8][3]

    ; Setup the URL's to download
    $DownloadArray[1][0] = "link1"
    $DownloadArray[2][0] = "link2"
    $DownloadArray[3][0] = "link3"
    $DownloadArray[4][0] = "link4"

    For $i = 1 To UBound($DownloadArray)-1

        ; Get the File size
        $FileSize = INetGetSize($DownloadArray[$i][0])

        ; Current File Size
        $DownloadArray[$i][1] = $FileSize

        ; Cumulative Total
        $DownloadArray[$i][2] = $TotalToDownload

        ; Add the current file size to the total
        $TotalToDownload += $FileSize
    Next

    ; Do the Downloads
    For $i = 1 To UBound($DownloadArray)-1

        ; Dow the download in the background
        $Download = INetGet($DownloadArray[$i][0], "C:\" & $i & ".XLS", 1, 1)

        ; Loop to update progress
        Do
            ; Get number of bytes read for current file
            $BytesDownloaded    = INetGetInfo($Download, 0)

            ; Add this to the cumulative total
            $DownloadedSoFar    = $DownloadArray[$i][2] + $BytesDownloaded

            ; Calculate the current file percentage
            $FileProgress       = Floor(($BytesDownloaded / $DownloadArray[$i][1]) * 100)

            ; Calculate the overall percentage
            $OverallProgress    = Floor(($DownloadedSoFar / $TotalToDownload) * 100)

            ; Update the Current FIle progress bar
            GUICtrlSetData($pb_File, $FileProgress)

            ; Only update the current file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_FilePercent) <> $FileProgress & " %" Then GUICtrlSetData($lbl_FilePercent, $FileProgress & " %")

            ; Update the overall progress bar
            GUICtrlSetData($pb_Overall, $OverallProgress)

            ; Only update the overall file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_OverallPercent) <> $OverallProgress & " %" Then GUICtrlSetData($lbl_OverallPercent, $OverallProgress & " %")

            ; Only update the title bar (overall) percent label if it has changed to avoid flickering
            If WinGetTitle($Form1, "") <> $OverallProgress & " % - Downloader" Then WinSetTitle($Form1, "", $OverallProgress & " % - Downloader")

        ; Continue loop until download is complete
        Until InetGetInfo($Download, 2)

        ; Set current file progress bar to 100% when complete
        GUICtrlSetData($pb_File, 100)

        ; Set current file percent label to 100% when complete
        GUICtrlSetData($lbl_FilePercent, "100 %")

    Next

    ; Set overall progress bar to 100% when complete
    GUICtrlSetData($pb_Overall, 100)

    ; Set overall percent label to 100% when complete
    GUICtrlSetData($lbl_OverallPercent, "100 %")

    ; Reset GUI
    WinSetTitle($Form1, "", "Downloader")

    GUICtrlSetData($pb_File, 0)
    GUICtrlSetData($lbl_FilePercent, "0 %")

    GUICtrlSetData($pb_Overall, 0)
    GUICtrlSetData($lbl_OverallPercent, "0 %")

    ; Enable the download button
    GUICtrlSetState($but_Download, $GUI_ENABLE)
 EndFunc


Func _NoDownload()

$hGUI = GUICreate("Cijfers", 130, 175)



$hButton_1 = GUICtrlCreateButton("1", 10, 10, 110, 30)
$hButton_2 = GUICtrlCreateButton("2", 10, 50, 110, 30)
$hButton_3 = GUICtrlCreateButton("3", 10, 90, 110, 30)
$hButton_4 = GUICtrlCreateButton("4", 10, 130, 110, 30)

GUISetState()


    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
Case $hButton_1
   If FileExists("C:\1.xls") Then
       _check1ok ()
         Else
          MsgBox(4096, "1", "1 bestand is niet gedownload")
             EndIf
                  Func _check1ok()
                     $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\1.xls")
                              EndFunc

Case $hButton_2
   If FileExists("C:\2.xls") Then
      _check2ok ()
         Else
            MsgBox(4096, "2", "2 bestand is niet gedownload")
               EndIf

                  Func _check2ok()
                     $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\2.xls")
                              EndFunc

Case $hButton_3
   If FileExists("C:\3.xls") Then
         _check3ok ()
            Else
               MsgBox(4096, "3", "3 bestand is niet gedownload")
                  EndIf

                  Func _check3ok()
                     $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\3.xls")
                              EndFunc


Case $hButton_4
   If FileExists("C:\4.xls") Then
         _check4ok ()
            Else
               MsgBox(4096, "4", "4 bestand is niet gedownload")
                  EndIf

                  Func _check4ok()
                     $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\4.xls")
                           EndFunc
                        EndSwitch

EndFunc

 

Edited by Msb12i
Link to comment
Share on other sites

  • Moderators

Msb12i,

Move the smaller functions outside the _NoDownload function - you cannot declare functions inside another.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Msb12i,

Move the smaller functions outside the _NoDownload function - you cannot declare functions inside another.

M23

 

Tnx for the reply,

I deleted the func inside _nodownload but then I loose the notification that the file does not exists. Because my Then command cannot find the _check1ok command.

 

 If FileExists("C:\1.xls") Then
       _check1ok ()

Is there another command that I missed that can help my Then command execute the:

$oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\1.xls")

 

Link to comment
Share on other sites

  • Moderators

Msb12i,

I did not say "delete" the function, I said "move" it. Try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <Excel.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>

If _Singleton("Downloader", 1) = 0 Then
    MsgBox($MB_SYSTEMMODAL, "Let op!", "Dit programma kan maar één keer geopend worden!")
    Exit
EndIf



Do
    $pass = InputBox("Login", "Wachtwoord ingeven AUB", "", "*", 175, 120)
    If $pass <> "password" Then
        Exit
    EndIf

Until $pass == "password"

Opt("TrayMenuMode", 1)

$Form1 = GUICreate("Downloader", 400, 170, -1, -1)

$pb_File = GUICtrlCreateProgress(30, 30, 300, 20, $PBS_SMOOTH)
$lbl_FilePercent = GUICtrlCreateLabel("0 %", 335, 32, 35, 16, $SS_RIGHT)

$pb_Overall = GUICtrlCreateProgress(30, 80, 300, 20, $PBS_SMOOTH)
$lbl_OverallPercent = GUICtrlCreateLabel("0 %", 335, 82, 35, 16, $SS_RIGHT)

$but_Download = GUICtrlCreateButton("Download Starten", 45, 120, 125, 30)
$but_Download2 = GUICtrlCreateButton("Download Overslaan", 195, 120, 125, 30)

GUISetState(@SW_SHOW)

While 1

    $nMsg = GUIGetMsg()
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
    If $nMsg = $but_Download Then _Download()
    If $nMsg = $but_Download2 Then _NoDownload()

WEnd

Func _Download()

    ; Disable the download button
    GUICtrlSetState($but_Download, $GUI_DISABLE)

    ; Reset total filesize to download
    $TotalToDownload = 0

    Dim $DownloadArray[8][3]

    ; Setup the URL's to download
    $DownloadArray[1][0] = "link1"
    $DownloadArray[2][0] = "link2"
    $DownloadArray[3][0] = "link3"
    $DownloadArray[4][0] = "link4"

    For $i = 1 To UBound($DownloadArray) - 1

        ; Get the File size
        $FileSize = InetGetSize($DownloadArray[$i][0])

        ; Current File Size
        $DownloadArray[$i][1] = $FileSize

        ; Cumulative Total
        $DownloadArray[$i][2] = $TotalToDownload

        ; Add the current file size to the total
        $TotalToDownload += $FileSize
    Next

    ; Do the Downloads
    For $i = 1 To UBound($DownloadArray) - 1

        ; Dow the download in the background
        $Download = InetGet($DownloadArray[$i][0], "C:\" & $i & ".XLS", 1, 1)

        ; Loop to update progress
        Do
            ; Get number of bytes read for current file
            $BytesDownloaded = InetGetInfo($Download, 0)

            ; Add this to the cumulative total
            $DownloadedSoFar = $DownloadArray[$i][2] + $BytesDownloaded

            ; Calculate the current file percentage
            $FileProgress = Floor(($BytesDownloaded / $DownloadArray[$i][1]) * 100)

            ; Calculate the overall percentage
            $OverallProgress = Floor(($DownloadedSoFar / $TotalToDownload) * 100)

            ; Update the Current FIle progress bar
            GUICtrlSetData($pb_File, $FileProgress)

            ; Only update the current file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_FilePercent) <> $FileProgress & " %" Then GUICtrlSetData($lbl_FilePercent, $FileProgress & " %")

            ; Update the overall progress bar
            GUICtrlSetData($pb_Overall, $OverallProgress)

            ; Only update the overall file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_OverallPercent) <> $OverallProgress & " %" Then GUICtrlSetData($lbl_OverallPercent, $OverallProgress & " %")

            ; Only update the title bar (overall) percent label if it has changed to avoid flickering
            If WinGetTitle($Form1, "") <> $OverallProgress & " % - Downloader" Then WinSetTitle($Form1, "", $OverallProgress & " % - Downloader")

            ; Continue loop until download is complete
        Until InetGetInfo($Download, 2)

        ; Set current file progress bar to 100% when complete
        GUICtrlSetData($pb_File, 100)

        ; Set current file percent label to 100% when complete
        GUICtrlSetData($lbl_FilePercent, "100 %")

    Next

    ; Set overall progress bar to 100% when complete
    GUICtrlSetData($pb_Overall, 100)

    ; Set overall percent label to 100% when complete
    GUICtrlSetData($lbl_OverallPercent, "100 %")

    ; Reset GUI
    WinSetTitle($Form1, "", "Downloader")

    GUICtrlSetData($pb_File, 0)
    GUICtrlSetData($lbl_FilePercent, "0 %")

    GUICtrlSetData($pb_Overall, 0)
    GUICtrlSetData($lbl_OverallPercent, "0 %")

    ; Enable the download button
    GUICtrlSetState($but_Download, $GUI_ENABLE)
EndFunc   ;==>_Download


Func _NoDownload()

    $hGUI = GUICreate("Cijfers", 130, 175)

    $hButton_1 = GUICtrlCreateButton("1", 10, 10, 110, 30)
    $hButton_2 = GUICtrlCreateButton("2", 10, 50, 110, 30)
    $hButton_3 = GUICtrlCreateButton("3", 10, 90, 110, 30)
    $hButton_4 = GUICtrlCreateButton("4", 10, 130, 110, 30)

    GUISetState()

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            If FileExists("C:\1.xls") Then
                _check1ok()
            Else
                MsgBox(4096, "1", "1 bestand is niet gedownload")
            EndIf

        Case $hButton_2
            If FileExists("C:\2.xls") Then
                _check2ok()
            Else
                MsgBox(4096, "2", "2 bestand is niet gedownload")
            EndIf

        Case $hButton_3
            If FileExists("C:\3.xls") Then
                _check3ok()
            Else
                MsgBox(4096, "3", "3 bestand is niet gedownload")
            EndIf

        Case $hButton_4
            If FileExists("C:\4.xls") Then
                _check4ok()
            Else
                MsgBox(4096, "4", "4 bestand is niet gedownload")
            EndIf

    EndSwitch

EndFunc   ;==>_NoDownload

Func _check1ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\1.xls")
EndFunc   ;==>_check1ok

Func _check2ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\2.xls")
EndFunc   ;==>_check2ok

Func _check3ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\3.xls")
EndFunc   ;==>_check3ok

Func _check4ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\4.xls")
EndFunc   ;==>_check4ok

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Msb12i,

I did not say "delete" the function, I said "move" it. Try this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <Excel.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>

If _Singleton("Downloader", 1) = 0 Then
    MsgBox($MB_SYSTEMMODAL, "Let op!", "Dit programma kan maar één keer geopend worden!")
    Exit
EndIf



Do
    $pass = InputBox("Login", "Wachtwoord ingeven AUB", "", "*", 175, 120)
    If $pass <> "password" Then
        Exit
    EndIf

Until $pass == "password"

Opt("TrayMenuMode", 1)

$Form1 = GUICreate("Downloader", 400, 170, -1, -1)

$pb_File = GUICtrlCreateProgress(30, 30, 300, 20, $PBS_SMOOTH)
$lbl_FilePercent = GUICtrlCreateLabel("0 %", 335, 32, 35, 16, $SS_RIGHT)

$pb_Overall = GUICtrlCreateProgress(30, 80, 300, 20, $PBS_SMOOTH)
$lbl_OverallPercent = GUICtrlCreateLabel("0 %", 335, 82, 35, 16, $SS_RIGHT)

$but_Download = GUICtrlCreateButton("Download Starten", 45, 120, 125, 30)
$but_Download2 = GUICtrlCreateButton("Download Overslaan", 195, 120, 125, 30)

GUISetState(@SW_SHOW)

While 1

    $nMsg = GUIGetMsg()
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
    If $nMsg = $but_Download Then _Download()
    If $nMsg = $but_Download2 Then _NoDownload()

WEnd

Func _Download()

    ; Disable the download button
    GUICtrlSetState($but_Download, $GUI_DISABLE)

    ; Reset total filesize to download
    $TotalToDownload = 0

    Dim $DownloadArray[8][3]

    ; Setup the URL's to download
    $DownloadArray[1][0] = "link1"
    $DownloadArray[2][0] = "link2"
    $DownloadArray[3][0] = "link3"
    $DownloadArray[4][0] = "link4"

    For $i = 1 To UBound($DownloadArray) - 1

        ; Get the File size
        $FileSize = InetGetSize($DownloadArray[$i][0])

        ; Current File Size
        $DownloadArray[$i][1] = $FileSize

        ; Cumulative Total
        $DownloadArray[$i][2] = $TotalToDownload

        ; Add the current file size to the total
        $TotalToDownload += $FileSize
    Next

    ; Do the Downloads
    For $i = 1 To UBound($DownloadArray) - 1

        ; Dow the download in the background
        $Download = InetGet($DownloadArray[$i][0], "C:\" & $i & ".XLS", 1, 1)

        ; Loop to update progress
        Do
            ; Get number of bytes read for current file
            $BytesDownloaded = InetGetInfo($Download, 0)

            ; Add this to the cumulative total
            $DownloadedSoFar = $DownloadArray[$i][2] + $BytesDownloaded

            ; Calculate the current file percentage
            $FileProgress = Floor(($BytesDownloaded / $DownloadArray[$i][1]) * 100)

            ; Calculate the overall percentage
            $OverallProgress = Floor(($DownloadedSoFar / $TotalToDownload) * 100)

            ; Update the Current FIle progress bar
            GUICtrlSetData($pb_File, $FileProgress)

            ; Only update the current file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_FilePercent) <> $FileProgress & " %" Then GUICtrlSetData($lbl_FilePercent, $FileProgress & " %")

            ; Update the overall progress bar
            GUICtrlSetData($pb_Overall, $OverallProgress)

            ; Only update the overall file percent label if it has changed to avoid flickering
            If GUICtrlRead($lbl_OverallPercent) <> $OverallProgress & " %" Then GUICtrlSetData($lbl_OverallPercent, $OverallProgress & " %")

            ; Only update the title bar (overall) percent label if it has changed to avoid flickering
            If WinGetTitle($Form1, "") <> $OverallProgress & " % - Downloader" Then WinSetTitle($Form1, "", $OverallProgress & " % - Downloader")

            ; Continue loop until download is complete
        Until InetGetInfo($Download, 2)

        ; Set current file progress bar to 100% when complete
        GUICtrlSetData($pb_File, 100)

        ; Set current file percent label to 100% when complete
        GUICtrlSetData($lbl_FilePercent, "100 %")

    Next

    ; Set overall progress bar to 100% when complete
    GUICtrlSetData($pb_Overall, 100)

    ; Set overall percent label to 100% when complete
    GUICtrlSetData($lbl_OverallPercent, "100 %")

    ; Reset GUI
    WinSetTitle($Form1, "", "Downloader")

    GUICtrlSetData($pb_File, 0)
    GUICtrlSetData($lbl_FilePercent, "0 %")

    GUICtrlSetData($pb_Overall, 0)
    GUICtrlSetData($lbl_OverallPercent, "0 %")

    ; Enable the download button
    GUICtrlSetState($but_Download, $GUI_ENABLE)
EndFunc   ;==>_Download


Func _NoDownload()

    $hGUI = GUICreate("Cijfers", 130, 175)

    $hButton_1 = GUICtrlCreateButton("1", 10, 10, 110, 30)
    $hButton_2 = GUICtrlCreateButton("2", 10, 50, 110, 30)
    $hButton_3 = GUICtrlCreateButton("3", 10, 90, 110, 30)
    $hButton_4 = GUICtrlCreateButton("4", 10, 130, 110, 30)

    GUISetState()

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            If FileExists("C:\1.xls") Then
                _check1ok()
            Else
                MsgBox(4096, "1", "1 bestand is niet gedownload")
            EndIf

        Case $hButton_2
            If FileExists("C:\2.xls") Then
                _check2ok()
            Else
                MsgBox(4096, "2", "2 bestand is niet gedownload")
            EndIf

        Case $hButton_3
            If FileExists("C:\3.xls") Then
                _check3ok()
            Else
                MsgBox(4096, "3", "3 bestand is niet gedownload")
            EndIf

        Case $hButton_4
            If FileExists("C:\4.xls") Then
                _check4ok()
            Else
                MsgBox(4096, "4", "4 bestand is niet gedownload")
            EndIf

    EndSwitch

EndFunc   ;==>_NoDownload

Func _check1ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\1.xls")
EndFunc   ;==>_check1ok

Func _check2ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\2.xls")
EndFunc   ;==>_check2ok

Func _check3ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\3.xls")
EndFunc   ;==>_check3ok

Func _check4ok()
    $oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\4.xls")
EndFunc   ;==>_check4ok

M23

OMG I feel so dumb..

 

Case $hButton_1
   If FileExists("C:\1.xls") Then
          $oExcel = ObjCreate("Excel.Application")
                        $oExcel.Visible = 1
                           $oExcel.WorkBooks.Open("C:\1.xls")
         If Not FileExists ("C:\1.xls") Then
          MsgBox(4096, "1", "1 bestand is niet gedownload")
             EndIf

This was I was trying to do ^_^

 

So every func I define is usable in the whole script? I was looking for a solution since yesterday.

 

In my next script I promised myself I will use the green explanation text, because I was kinda lost in my own script.

 

 

Edited by Msb12i
Link to comment
Share on other sites

  • Moderators

Msb12i,

So every func I define is usable in the whole script?

Yes.

 I promised myself I will use the green explanation text, because I was kinda lost in my own script

A very good idea!

M23

P.S.  When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote and it just pads the thread unnecessarily.

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...