Jump to content
Sign in to follow this  
Rigest

Problem with variables when executing a function several times

Recommended Posts

Rigest

So as I'm finishing my script I'm encountering a major flaw. I want that the functions executeit and wisinvoer (erase input) can be executed several times (after you change the input for example). The problem is that with executeit several variables are changed, even though it is the exact same function. Some variables even take on labels from the GUI, I never seen this before. With wisinvoer (erase input) several input fields don't get erased.

The strange thing is that some variables do stay correct but most of them got messed up.

It probably is something very simple or foolish but I've been struggling with this for more than a day. Any help is greatly appriciated. I've pasted the code below, but it is a pretty long (and probably messy) script. Thanks in advanche.

#include <IE.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <Constants.au3>
#Include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <ScreenCapture.au3>


$Form1 = GUICreate("Mercury", 1275, 965, 0, 0)
GUISetBkColor(0xFFFFFF)
$oIE = ObjCreate("Shell.Explorer.2")
$oIE2 = ObjCreate("Shell.Explorer.2")
$oIE3 = ObjCreate("Shell.Explorer.2")
$handlelogi = ""
;Alle stappen die doorlopen worden

$statusgroep = Guictrlcreategroup ("Voortgang", 1020, 10, 350, 650)
$labelkvkinlog = guictrlcreatelabel("Concernrelaties", 1025, 28)
$labelkvkuitreksel = guictrlcreatelabel("KVK uitreksel ophalen", 1025, 48)
$labelkvkhistorie = guictrlcreatelabel("KVK historie ophalen", 1025, 68)


$labelbkr = guictrlcreatelabel("BKR raadplegen", 1025, 108)
$labeleva = guictrlcreatelabel("EVA raadplegen", 1025, 128)
$labelgraydon = guictrlcreatelabel("Graydon raadplegen", 1025, 148)

$labelgdm = guictrlcreatelabel("GDM raadplegen", 1025, 188)
$labeldealer = guictrlcreatelabel("Dealer geïnformeerd", 1025, 208)

$mercuryplaatje = GUICtrlCreatePic(@scriptdir&"\mercury.bmp", 1100, 500)
;stappen zijn gelukt
$kvkconcerngoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 23,20,20)
GUICtrlSetState ( $kvkconcerngoed, $GUI_HIDE)
$kvkuitrekselgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 43,20,20)
GUICtrlSetState ($kvkuitrekselgoed , $GUI_HIDE)
$kvkhistoriegoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 63,20,20)
GUICtrlSetState ( $kvkhistoriegoed, $GUI_HIDE)


$accesgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 163,20,20)
GUICtrlSetState ( $accesgoed, $GUI_HIDE)
$kvkgdmgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 183,20,20)
GUICtrlSetState ( $kvkgdmgoed, $GUI_HIDE)
$dealergoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 203,20,20)
GUICtrlSetState ( $dealergoed, $GUI_HIDE)

;stappen zijn mislukt

$kvkhistorieslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 63,20,20)
GUICtrlSetState ( $kvkhistorieslecht, $GUI_HIDE)
$kvkuitrekselslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 43,20,20)
GUICtrlSetState ( $kvkuitrekselslecht, $GUI_HIDE)


$graydonslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 143,20,20)
GUICtrlSetState ($graydonslecht, $GUI_HIDE)
$gdmslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 183,20,20)
GUICtrlSetState ( $gdmslecht, $GUI_HIDE)
$dealerslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 203,20,20)
GUICtrlSetState ($dealerslecht, $GUI_HIDE)

;speciale meldingen
$geenconcern = guictrlcreatelabel("Niet aanwezig", 1025, 88)
GUICtrlSetState ($geenconcern, $GUI_HIDE)
$bkrgeencodes = guictrlcreatelabel("Geen BKR coderingen", 1150, 108)
GUICtrlSetState ($bkrgeencodes, $GUI_HIDE)
$bkrwelcodes = guictrlcreatelabel("BKR coderingen", 1150, 108)
GUICtrlSetState ($bkrwelcodes, $GUI_HIDE)
$evageen = guictrlcreatelabel("Geen EVA melding", 1150, 128)
GUICtrlSetState ($evageen, $GUI_HIDE)
$evawel = guictrlcreatelabel("EVA melding", 1150, 128)
GUICtrlSetState ($evawel, $GUI_HIDE)
$graydongeen = guictrlcreatelabel("Geen Graydon melding", 1150, 148)
GUICtrlSetState ($graydongeen, $GUI_HIDE)
$graydonwel = guictrlcreatelabel("Graydon melding", 1150, 148)
GUICtrlSetState ($graydonwel, $GUI_HIDE)
$gdmaccept = guictrlcreatelabel("Geaccepteerd", 1150, 188)
GUICtrlSetState ($gdmaccept, $GUI_HIDE)
$gdmpending = guictrlcreatelabel("Pending", 1150, 188)
GUICtrlSetState ($gdmpending, $GUI_HIDE)
$gdmreject = guictrlcreatelabel("Geweigerd", 1150, 188)
GUICtrlSetState ($gdmreject, $GUI_HIDE)

;Start GUI
$Label1 = GUICtrlCreateLabel("Offerte nummer      :", 8, 24, 132, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label2 = GUICtrlCreateLabel("Aanvraag nummer  :", 8, 56, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Debiteur nummer  :", 237, 24, 127, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$offertenr = GUICtrlCreateInput("", 144, 24, 65, 21)
$aanvraagnr = GUICtrlCreateInput("", 144, 56, 65, 21)
$debitnr = GUICtrlCreateInput("", 376, 24, 65, 21)
$Group1 = GUICtrlCreateGroup("Kredietaanvraag gegevens", 0, 8, 473, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Algemene gegevens", 0, 104, 473, 81)
$Date1 = GUICtrlCreateDate(@year&"/"&@mon&"/"&@MDAY&" "&@Hour&":"&@Min&":"&@SEC, 144, 128, 138, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$bijklant = GUICtrlCreateCombo("Uitbreiding", 144, 152, 81, 21)
GUICtrlSetData(-1,"Vervanging")
$Label4 = GUICtrlCreateLabel("Datum aanvraag     :", 8, 128, 133, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label5 = GUICtrlCreateLabel("Bij klant                  :", 8, 154, 132, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Behandelaar  :", 291, 128, 98, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label7 = GUICtrlCreateLabel("Bij Afbin          :", 288, 152, 102, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Behandelaar = GUICtrlCreateInput(@Username, 392, 128, 65, 21)
$bijafbin = GUICtrlCreateCombo("Uitbreiding", 392, 152, 65, 21)
GUICtrlSetData(-1,"Vervanging")
$Group3 = GUICtrlCreateGroup("Aanvrager gegevens", 0, 280, 473, 153)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label8 = GUICtrlCreateLabel("Aanvrager (bedrijf)  :", 8, 304, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label9 = GUICtrlCreateLabel("KVK nummer           :", 8, 328, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label10 = GUICtrlCreateLabel("Contactpersoon       :", 8, 352, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label11 = GUICtrlCreateLabel("Telefoon                  :", 8, 376, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label12 = GUICtrlCreateLabel("Mobiel                     :", 8, 400, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label13 = GUICtrlCreateLabel("Accountant        :", 248, 352, 111, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label14 = GUICtrlCreateLabel("Telefoon            :", 248, 376, 112, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$dealernaam = GUICtrlCreateInput("", 150, 216, 65, 21)
$verkoper = GUICtrlCreateInput("", 150, 240, 65, 21)
$dealernr = GUICtrlCreateInput("", 390, 216, 65, 21)
$dealertel = GUICtrlCreateInput("", 390, 240, 65, 21)
$aanvrager = GUICtrlCreateInput("", 152, 304, 65, 21)
$kvknummer = GUICtrlCreateInput("", 152, 328, 65, 21)
GuiCtrlSetLimit ($kvknummer, 8,8)
$contactpers = GUICtrlCreateInput("", 152, 352, 65, 21)
$telefoon = GUICtrlCreateInput("", 152, 376, 65, 21)
$mobiel = GUICtrlCreateInput("", 152, 400, 65, 21)
$accountant = GUICtrlCreateInput("", 368, 352, 65, 21)
$accounttel = GUICtrlCreateInput("", 368, 376, 65, 21)
$Group4 = GUICtrlCreateGroup("Dealer gegevens", 0, 192, 473, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label15 = GUICtrlCreateLabel("Dealer-naam           :", 8, 216, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label16 = GUICtrlCreateLabel("Verkoper                 :", 8, 240, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label17 = GUICtrlCreateLabel("Dealer nummer          :", 243, 216, 147, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label18 = GUICtrlCreateLabel("Telefoon                     :", 242, 240, 148, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Group5 = GUICtrlCreateGroup("Object gegevens", 0, 436, 473, 153)
$Group6 = GUICtrlCreateGroup("Indien gebruikt", 240, 456, 217, 129)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label19 = GUICtrlCreateLabel("Automerk                  :", 8, 460, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label20 = GUICtrlCreateLabel("Autotype                   :", 8, 484, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label21 = GUICtrlCreateLabel("Looptijd                    :", 8, 508, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label22 = GUICtrlCreateLabel("Nieuwe auto (ja/nee):", 8, 532, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUICtrlSetTip(-1, "8")
$Label23 = GUICtrlCreateLabel("Actie                        :", 12, 556, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$automerk = GUICtrlCreateInput("", 156, 460, 65, 21)
$autotype = GUICtrlCreateInput("", 156, 484, 65, 21)
$looptijd = GUICtrlCreateInput("", 156, 508, 65, 21)
$newauto = GUICtrlCreateCombo("Nieuw", 156, 532, 65, 21)
GUICtrlSetData(-1,"Gebruikt")
$actie = GUICtrlCreateCombo("", 156, 556, 65, 21)
GUICtrlSetData(-1,"H2000|Mail|Anders")
$datdeel1 = GUICtrlCreateCombo("", 374, 475, 65, 21)
GUICtrlSetData(-1,"0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40")
$Label24 = GUICtrlCreateLabel("Leeftijd in jr      :", 252, 475, 120, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$kmstand = GUICtrlCreateInput("", 374, 505, 65, 21)
$Label25 = GUICtrlCreateLabel("Kilometerafstand :", 254, 505, 120, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$kenteken = GUICtrlCreateInput("", 374, 542, 65, 21)
$Label26 = GUICtrlCreateLabel("Kenteken            :", 254, 542, 116, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Group7 = GUICtrlCreateGroup("Contract gegevens", 0, 592, 505, 229)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label27 = GUICtrlCreateLabel("Contract type           :", 8, 616, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label28 = GUICtrlCreateLabel("Verkoopprijs            €", 8, 640, 139, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label29 = GUICtrlCreateLabel("Aanbetaling             €", 8, 664, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label30 = GUICtrlCreateLabel("Inruil                        €", 8, 688, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label31 = GUICtrlCreateLabel("Overname bij FL      €", 8, 712, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label32 = GUICtrlCreateLabel("(excl. btw)", 228, 640, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$contracttype = GUICtrlCreateCombo("", 156, 616, 65, 21)
GUICtrlSetData(-1,"OL|FL|LV")
$verkoopprijs = GUICtrlCreateInput("", 156, 640, 65, 21)
$aanbet = GUICtrlCreateInput("", 156, 664, 65, 21)
$inruil = GUICtrlCreateInput("", 156, 688, 65, 21)
$overnamebijfl = GUICtrlCreateInput("", 156, 712, 65, 21)
$Label34 = GUICtrlCreateLabel("(excl. btw)", 228, 667, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label35 = GUICtrlCreateLabel("(excl. btw)", 228, 691, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label36 = GUICtrlCreateLabel("(excl. btw)", 228, 715, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$inzet = GUICtrlCreateInput("", 156, 744, 65, 21)
$Label47 = GUICtrlCreateLabel("Inzetbedrag             €", 8, 744, 145, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label37 = GUICtrlCreateLabel("_____________", 152, 728, 82, 17)
$slotterm = GUICtrlCreateInput("", 156, 769, 65, 21)
$Label38 = GUICtrlCreateLabel("Slottermijn bij FL     €", 8, 769, 145, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label39 = GUICtrlCreateLabel("(excl. btw)", 231, 775, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$leasetarief = GUICtrlCreateInput("", 156, 795, 65, 21)
$Label40 = GUICtrlCreateLabel("Leasetarief p.m.      €", 8, 795, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label33 = GUICtrlCreateLabel("Verv. Vervoer", 334, 764, 91, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label41 = GUICtrlCreateLabel("Brandstof", 334, 735, 64, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label42 = GUICtrlCreateLabel("Verzekering", 334, 706, 81, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label43 = GUICtrlCreateLabel("HSB", 334, 678, 31, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label44 = GUICtrlCreateLabel("ROB", 334, 649, 32, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$rob = GUICtrlCreateCombo("Nee", 428, 648, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$hsb = GUICtrlCreateCombo("Nee", 428, 679, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$verzekering = GUICtrlCreateCombo("Nee", 428, 708, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$brandstof = GUICtrlCreateCombo("Nee", 428, 738, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$vervoer= GUICtrlCreateCombo("Nee", 428, 767, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$opmerking = GUICtrlCreateEdit("", 8, 836, 497, 61)
$whatitdo = GUICtrlCreateGroup("Opmerkingen", 0, 820, 505, 93)

$Button1 = GUICtrlCreateButton("Start onderzoek", 32, 920, 137, 33)
$Button2 = GUICtrlCreateButton("Wis alle invoer", 252, 920, 137, 33)
$Label45= GUICtrlCreateLabel("Bedrijfsvorm:", 527, 720)
$Label46 = GUICtrlCreateLabel("Eigenaren:", 527, 770)
$busform = GUICtrlCreateInput("", 527, 740, 300, 21)

$listview = GUICtrlCreateListView("Naam                         |Bedrijf                        |Bedrijfsvorm                  |Geboortedatum", 527, 785, 500, 100)
$naam1 = GUICtrlCreateList("", 527, 785, 300, 100)
$handle = _IECreate2(630, 650, $Form1)
Winsetstate($handle, "", @SW_SHOW)

$tab = GUICtrlCreateTab(510, 5, 500, 680)
$tab3 = GUICtrlCreateTabItem("KvK")
$KVK = GUICtrlCreateObj($oIE, 520, 30, 500, 650)
$tab1 = GUICtrlCreateTabItem("Graydon")
$Graydon = GUICtrlCreateObj($oIE2, 520, 30, 500, 650)
$tab2 = GUICtrlCreateTabItem("GDM")
$GDM = GUICtrlCreateObj($oIE3, 520, 30, 500, 650)




$oIE.navigate("www.kvk.nl")
$oIE2.navigate("https://mijn.graydon.nl/wps/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3iTEB_34BAzYwN3n1AnAyMfE79gI2cfAwNjY6B8pFm8n79RqJuJp6GhhZmroYGRmYeJk0-Yp4G7izEB3X4e-bmp-gW5EeUABb6wHQ!!/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfNFRMR1NUNjMwR0xVQjAyTDROUzJDTDAwTjQ!/?menulink=1")
$oIE3.navigate("https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GuiGetMsg()
   
        Select
            Case $msg = $GUI_EVENT_CLOSE
            Exit
            
        Case $msg = $Button2
            wisinvoer ()
            
        Case $msg = $Button1
        executeit ()
        Func executeit ()
                wisplaatjes ()
                            
                $kvknr = Guictrlread($kvknummer)
                $gevonden = 0
                _IEloadwait($oIE)
                Winsetstate($handle, "", @SW_SHOW)  
                GUICtrlSetState ( $tab3, $GUI_SHOW)
                GUIctrlsetdata($busform,"")
                _GUICtrlListView_DeleteAllItems($listview)
                $offertenr = Guictrlread ($offertenr)
                $aanvraagnr = Guictrlread ($aanvraagnr) 
                $debiteurnr = Guictrlread ($debitnr)
                $datumaanvraag = Guictrlread ($Date1)
                $bijklant = Guictrlread ($bijklant)
                $bijafbin = Guictrlread ($bijafbin)
                $dealernr = Guictrlread ($dealernr)
                $dealernaam = Guictrlread ($dealernaam)
                $verkoper = GUICtrlRead ($verkoper)
                $telefoon = Guictrlread ($dealertel)
                $aanvrager = Guictrlread ($aanvrager)
                $kontaktpersoon = Guictrlread ($contactpers)
                $telefoon2 = Guictrlread ($telefoon)
                $mobiel = GUICtrlRead ($mobiel)
                $accountant = GUICtrlRead ($accountant)
                $telefoon3 = Guictrlread ($accounttel)
                $looptijd = Guictrlread ($looptijd) 
            ;   $km = 
                $oudofnieuw = guictrlread ($newauto)
                $aktie = guictrlread ($actie)
                $contractsoort = guictrlread ($contracttype)
            ;   $bpm 
            ;   $bpmtekst
                $verkoopprijs = Guictrlread ($verkoopprijs)
                $aanbetaling = Guictrlread ($aanbet)
                $overname = Guictrlread ($overnamebijfl)
                $slottermijn = Guictrlread ($slotterm)
                $inzetbedrag = Guictrlread ($inzet)
                $leasetarief = Guictrlread ($leasetarief)
                $rob1 = Guictrlread ($rob)
                $hsb1 = Guictrlread ($hsb)
                $verzekering1= Guictrlread ($verzekering)
                $brandstof1 = guictrlread ($brandstof)
                $vervoer1 = guictrlread ($vervoer)
                $kmstand = Guictrlread ($kmstand)
                $kenteken = Guictrlread ($kenteken)
                $automerk = Guictrlread ($automerk)
                $autotype = Guictrlread ($autotype)
                $opmerking = Guictrlread ($opmerking)
                
                If $rob1 = "Ja" then 
                    $rob = "1"
                else 
                $rob = "0"
                EndIf
                If $hsb1 = "Ja" then 
                $hsb = "1"
                else 
                $hsb = "0"
                EndIf
                If $verzekering1 = "Ja" then 
                $verzekering = "1"
                else 
                $verzekering = "0"
                EndIf
                If $brandstof1 = "Ja" then 
                $brandstof = "1"
                else 
                $brandstof = "0"
                EndIf
                If $vervoer1 = "Ja" then 
                $vervoer = "1"
                else 
                $vervoer = "0"
                EndIf
                
                $owners = kvk($kvknr,$aanvraagnr)
                $historie = kvkhistorie ($kvknr, $aanvraagnr)
                $BKRCODE = toetsing($owners,$aanvraagnr)
                if $BKRCODE <> "4" then 
                $uitslag = graydonall($owners, $kvknr)
                    if $uitslag = "Reject" then
                    GUICtrlSetState ( $graydonwel, $GUI_SHOW)
                    elseif $uitslag = "Accept" then 
                    GUICtrlSetState ( $graydongeen, $GUI_SHOW)
                    local $gdmarray[10] 
                    $gdmarray[0] = $aanvraagnr
                    $gdmarray[1] = $dealernr
                    $gdmarray[2] = $verkoopprijs
                    $gdmarray[3] = $inzetbedrag
                    $gdmarray[4] = $slottermijn
                    $gdmarray[5] = $looptijd
                    $leeftijd = 0
                    if GUICtrlread($datdeel1) <> "" then $leeftijd = GUICtrlread($datdeel1)
                    $gdmarray[6] = $leeftijd
                    $gdmarray[7] = 1
                    $gdmarray[9] = 1
                    GDM($kvknr, $gdmarray)
                    
                    endif
                            
                endif
            allesnaaracces ($offertenr, $aanvraagnr,$datumaanvraag ,$dealernaam,$verkoper,$telefoon,$aanvrager,$kvknr,$kontaktpersoon,$telefoon2, $automerk,$autotype, $looptijd,$oudofnieuw,$contractsoort,  $verkoopprijs, $inzetbedrag, $leasetarief, $rob, $hsb, $verzekering, $vervoer,$brandstof, $bijafbin, $dealernr, $aktie,$aanbetaling,"","",  "",  "", "", "","" , $opmerking , "","", "","")
        Endfunc
                
            ;Case $msg = $Button1
            ;    GUISetState(@SW_SHOW, $Form2)
            Case $msg = $tab
                $tabnr = Guictrlread($tab)
                if $tabnr = 0 Then
                Winsetstate($handle, "", @SW_SHOW)  
                Else
                Winsetstate($handle, "", @SW_HIDE)  
                endif
        
        EndSelect

WEnd
Exit



func kvk($kvknr,$aanvraagnr)
    ;GUICtrlSetState ( $tab0, $GUI_SHOW)
    _IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/FU/TSWS001@?BUTT="&$kvknr&"0000")
    $gevonden = 0
    $links = $oIE.document.links
                For $link In $links
                if $link.outerText&"" = "Concernrelaties" then 
                    $gevonden = 1
                    $kliklink = $link
                    
                endif
            Next
    

    if $gevonden = 1 Then
    $kliklink.click
    _IEloadwait($oIE)
        writecompanyfile($aanvraagnr,"KVK concern relaties", $oIE)
        GUICtrlSetState ( $kvkhistoriegoed, $GUI_SHOW)
    ;_IELinkClickByIndex($oIE, 4)
    ;_IEloadwait($oIE)
    

    $topconcernsnrs = getkvklinks($oIE)
    ;_IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/FP/MDWS002@?BUTT=H"&$kvknr&"0000",0)
    ;While $oIE.Document.URL <> "https://server.db.kvk.nl/TST-BIN/FP/MDWS002@?BUTT=H"&$kvknr&"0000" AND winexists("Verbinding met server.db.kvk.nl maken") = 0
    ;Sleep(100)
    ;WEnd
    ;if winexists("Verbinding met server.db.kvk.nl maken") = 1 then
    ;   controlsend("Verbinding met server.db.kvk.nl maken","","Edit2","WWWQGiu8")
    ;   controlsend("Verbinding met server.db.kvk.nl maken","","Edit3","utrecht")
    ;   controlclick("Verbinding met server.db.kvk.nl maken","","Button2")
    ;endif
    ;_IEloadwait($oIE)
    ;_IElinkclickbyindex($oIE,1)
    ;_IEloadwait($oIE)
    GUICtrlSetState ( $kvkconcerngoed, $GUI_SHOW)
    ;$kvknr = kvknrget($oIE.Document.body.innerText)
    else 
    local $eenconcern[1][2]
    $eenconcern[0][0] = $kvknr
    $topconcernsnrs = $eenconcern
    GUICtrlSetState ( $geenconcern, $GUI_SHOW)
    endif

    local $totalowners[1][6]
    for $a=0 to ubound($topconcernsnrs,1)-1
    _IEnavigate($oIE,"https://server.db.kvk.nl/TST-BIN/RB/RBWWW06@?BUTT="&$topconcernsnrs[$a][0]&"0000&amp;JANE=TWDE",0)
    While $oIE.Document.URL <> "https://server.db.kvk.nl/TST-BIN/RB/RBWWW06@?BUTT="&$topconcernsnrs[$a][0]&"0000&amp;JANE=TWDE" AND winexists("Verbinding met server.db.kvk.nl maken") = 0
    Sleep(100)
    WEnd
    if winexists("Verbinding met server.db.kvk.nl maken") = 1 then
        controlsend("Verbinding met server.db.kvk.nl maken","","Edit2","WWWQGiu8")
        controlsend("Verbinding met server.db.kvk.nl maken","","Edit3","utrecht")
        controlclick("Verbinding met server.db.kvk.nl maken","","Button2")
    endif

    _IEloadwait($oIE)
    
    If $oIE.Document.URL = "https://server.db.kvk.nl/wwwsrvu/html/fout1002.htm" then
    GUICtrlSetState ( $kvkuitrekselslecht, $GUI_SHOW)
    Msgbox (0, "Foutmelding", "Mercury heeft geen uitreksel kunnen vinden en zal nu afsluiten. Mocht er wel een uitreksel zijn meld dit probleem a.u.b. bij de beheerders")
    else
    GUICtrlSetState ( $kvkuitrekselgoed, $GUI_SHOW)
    $content = $oIE.Document.body.innerText 
    writecompanyfile($aanvraagnr,"Kvk uitreksel", $oIE)

    $businessForm = GetBusinessForm($content)
    If $businessForm == "" Then
        MsgBox(4096, "Error", "No business form found")
        Return
    Else
        GUICtrlsetdata($busform, $businessForm)
    EndIf
    
    $owners = GetOwnerArray($content)
    

    if $a = 0 Then
        $totalowners = $owners
    else
    $totalowners = ArrayMerge($totalowners, $owners)
    endif
    For $i = 0 To UBound($owners, 1) - 1
    GUICtrlCreateListViewItem($owners[$i][0] & ", " & $owners[$i][1] & ", " & $owners[$i][2]&"|"&$topconcernsnrs[$a][1]&"|"&$owners[$i][6]&"|"&$owners[$i][3] & "-" & $owners[$i][4] & "-" & $owners[$i][5], $listview)
    ;GUICtrlsetdata($naam1,$owners[$i][0] & ", " & $owners[$i][1] & ", " & $owners[$i][2] & " " & $owners[$i][3] & "-" & $owners[$i][4] & "-" & $owners[$i][5]&" ("&$topconcernsnrs[$a][1]&")")
    next
    
    endif
    next
    GUISetState(@SW_SHOW, $Form1)
    return $totalowners
endfunc

func graydonall($owners, $kvknr)
    GUICTRLsetstate($tab1, $GUI_SHOW)
    winsetstate($handle,"", @SW_HIDE)

    for $i=0 to Ubound($owners,1)-1
        $uitslag = graydon($kvknr, $owners[$i][0], $owners[$i][3]&$owners[$i][4]&$owners[$i][5])
        
        if $uitslag = 0 then return "Reject"
        if $owners[$i][1] <> "" then 
            
            $uitslag = graydon($kvknr, $owners[$i][1], $owners[$i][5]&$owners[$i][4]&$owners[$i][5])
            if $uitslag = 0 then return "Reject"
        endif
    Next
    
return "Accept"

endfunc 

func graydon($kvknr, $achternaam, $gebdat)
    
    _IEnavigate($oIE2, "https://mijn.graydon.nl/wps/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3iTEB_34BAzYwN3n1AnAyMfE79gI2cfAwNjY6B8pFm8n79RqJuJp6GhhZmroYGRmYeJk0-Yp4G7izEB3X4e-bmp-gW5EeUABb6wHQ!!/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfNFRMR1NUNjMwR0xVQjAyTDROUzJDTDAwTjQ!/?menulink=1")
    if $oIE2.Document.URL <> "https://mijn.graydon.nl/wps/myportal" Then
        $form1 = _IEFormGetcollection($oIE2, 0)
        $username = _IEformelementgetobjbyname($form1, "wps.portlets.userid")
        $pw = _IEformelementgetobjbyname($form1, "password")
        _IEFormElementSetValue($username, "20963292")
        _IEFormElementSetValue($pw, "pompoen")
        _IEformsubmit($form1)
    endif
    

    $form = _IEFormGetcollection($oIE2, 0)
    $naaminput = _IEformelementgetobjbyname($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:naamInput")
    $gebdatinput = _IEformelementgetobjbyname($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:geboortedatumInput")
    _IEFormElementSetValue($naaminput, $achternaam)
    _IEFormElementSetValue($gebdatinput, $gebdat)
    $goeieknop = _IEFormElementGetObjByName($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:lnkStartZoeken")
    _IEAction ($goeieknop, "click")
    _IELoadWait ($oIE2)
    $grayreturn = _IEBodyReadHTML ($oIE2)
$uitslag = StringRegExp ($grayreturn, "zijn er in het NFR geen bedrijven of personen gevonden die aan uw zoekopdracht voldoen of uw zoekopdracht was niet specifiek genoeg",0)
if $uitslag = 0 Then
    _ielinkclickbyindex($oIE2, 17)
    _ieloadwait($oIE2)
    _ielinkclickbytext($oIE2, "Met betrokken bestuurders")
Endif
;$uitslag = 0 betekent slecht nieuws, 1 = goed nieuws. 
writefile($aanvraagnr, $achternaam, "Graydon", $oIE2)

    GUISetState(@SW_SHOW, $Form1)
Return $uitslag
endfunc

func GDM($kvknr, $gdmarray)
    winsetstate($handle,"",@SW_HIDE)
    GUICtrlsetstate($tab2, $GUI_SHOW)
    _IEnavigate($oIE3, "https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
    
    if $oIE3.Document.URL <> "https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S" then
        $form2 = _IEFormGetcollection($oIE3, 0)
        $username = _IEformelementgetobjbyname($form2, "userId")
        $pw = _IEformelementgetobjbyname($form2, "userPassword")
        $submit = _IEformelementgetobjbyname($form2, "submit1")
        _IEFormElementSetValue($username, "santmikeb")
        _IEFormElementSetValue($pw, "sant02")
        _IEaction($submit, "Click")
        _IEloadwait($oIE3)
    ;$form3 = _IEFormGetcollection($oIE3, 0)
    ;$signuplater = _IEFormElementGetCollection($form3,5)
    ;_IEaction($signuplater, "Click")
    ;_IEloadwait($oIE3)
    _ienavigate($oIE3,"https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
    endif

    _IEloadwait($oIE3)
    _ielinkclickbytext($oIE3, "KVK Number")
    _IEloadwait($oIE3)
    $form3 = _IEFormGetcollection($oIE3, 0)
    $kvkform = _IEformelementgetobjbyname($form3, "Busno")
    _IEFormElementSetValue($kvkform, $kvknr)
    $signuplater = _IEFormElementGetCollection($form3,3)
    _IEaction($signuplater, "Click")
    _IEloadwait($oIE3)
    _ielinkclickbytext($oIE3, "GDM Plus")
    $form3 = _IEFormGetcollection($oIE3, 0)
    $inputaanvr = _IEformelementgetcollection($form3, 10)
    $inputchan = _IEformelementgetcollection($form3, 11)
    $inputdeal = _IEformelementgetcollection($form3, 12)
    $inputaansch = _IEformelementgetcollection($form3, 14)
    $inputkred = _IEformelementgetcollection($form3, 15)
    $inputrestw = _IEformelementgetcollection($form3, 16)
    $inputloop = _IEformelementgetcollection($form3, 17)
    $inputleef = _IEformelementgetcollection($form3, 18)
    $inputbkr = _IEformelementgetcollection($form3, 19)
    $inputNFR = _IEformelementgetcollection($form3, 21)
    _IEFormElementSetValue($inputaanvr, $gdmarray[0])
    _IEFormElementSetValue($inputchan, "D")
    _IEFormElementSetValue($inputdeal, $gdmarray[1])
    _IEFormElementSetValue($inputaansch, $gdmarray[2])
    _IEFormElementSetValue($inputkred, $gdmarray[3])
    _IEFormElementSetValue($inputrestw, $gdmarray[4])
    _IEFormElementSetValue($inputloop, $gdmarray[5])
    _IEFormElementSetValue($inputleef, $gdmarray[6])
    _IEFormElementSetValue($inputbkr, $gdmarray[7])
    _IEFormElementSetValue($inputNFR, $gdmarray[9])
    $beslis = _IEformelementgetobjbyname($form3, "Submit")
    _IEaction($beslis, "Click")
    _ieloadwait($oIE3)
     $whatitdo = _IEBodyReadHTML($oIE3)
    $accept = StringRegExp ($whatitdo, "Accept.gif")
    $pending = StringRegExp ($whatitdo, "Pending.gif")
    $reject = StringRegExp ($whatitdo, "Reject.gif")

    If $accept = "1" then 
GUICtrlSetState ($gdmaccept, $GUI_SHOW)
    Elseif $pending = "1" Then
GUICtrlSetState ($gdmpending, $GUI_SHOW)
    Elseif $reject = "1" then 
GUICtrlSetState ($gdmreject, $GUI_SHOW)
    EndIf
    writecompanyfile($aanvraagnr,"GDM", $oIE3)

endfunc


Func ConsoleLog($data)
    ConsoleWrite($data & @CR)
EndFunc

; function to get business form
Func GetBusinessForm($content)
    $form = StringRegExp($content, "Rechtsvorm\s+:(.+)\r", 1)
    If UBound($form) == 0 Then
        Return ""
    Else
        Return $form[0]
    EndIf
EndFunc

; function to get names array {last name, maiden name, first name, last name, maiden name, first name, ......}
Func GetNamesArray($content)
    Return StringRegExp($content, "Naam\s+:([^\-\r]+)\-?(.+)?,\s+(.+)\r", 3)
EndFunc

; function to strip prefix in last name
Func StripPrefix($name)
    Return StringStripWS(StringRegExpReplace($name, "(van|de(r|n)?|aan|bij|het|'t|in|onder|op|over|des|'s|te(r|n)?|tot|uit|ver|voor)\s", ""), 1)
EndFunc

; function to get birth date array { day, month, year, day , month, year, ......}
Func GetBirthDateArray($content)
    Return StringRegExp($content, 'Geboortedatum\sen\s\-plaats\s+:(\d{2})\-(\d{2})\-(\d{4})', 3)
EndFunc

Func GetAdressnrArray($content)
    Return StringRegExp($content, 'Adres\s+:\D+\s(\d+),', 3)
EndFunc

Func GetZipcodeArray($content)
    Return StringRegExp($content, 'Adres\s+:\D+\s\d+, (\d+\D\D)', 3)
EndFunc

; function to check if person exists in owner array already
Func CheckIfExist($array, $lastName, $maidenName, $firstName, $day, $month, $year)
    For $i = 0 To UBound($array, 1) - 1
        If $array[$i][0] == $lastName And $array[$i][1] == $maidenName And $array[$i][2] == $firstName And $array[$i][3] == $day And $array[$i][4] == $month And $array[$i][5] == $year Then
            Return True
        EndIf
    Next
    Return False
EndFunc

; function to get owners array {{last name, maiden name, first name, day, month, year}, {last name, maiden name, first name, day, month, year}, ......}
Func GetOwnerArray($content)
    $busform = GetBusinessForm($content)
    $names = GetNamesArray($content)
    $birthDates = GetBirthDateArray($content)
    $adressnrs = ""
    $zipcodes = ""
    $adressnr = ""
    $zipcode = ""
    if NOT $busform = "Besloten Vennootschap" OR "Naamloze Vennootschap" then
    $adressnrs = GetAdressnrArray($content)
    $zipcodes = GetZipcodeArray($content)
    endif
    ; declare temp array
    Local $temp[UBound($names) / 3][9]
    
    $count = 0
    
    For $i = 0 To UBound($names) / 3 - 1
        ; strip out prefix from both last name and maiden name (if exists)
        $lastName   = StripPrefix($names[$i * 3])
        $maidenName = StripPrefix($names[$i * 3 + 1])
        $firstName  = $names[$i * 3 + 2]
        
        $day    = $birthDates[$i * 3]
        $month  = $birthDates[$i * 3 + 1]
        $year   = $birthDates[$i * 3 + 2]
        if NOT $busform = "Besloten Vennootschap" OR $busform = "Naamloze Vennootschap" then
        $adressnr = $adressnrs[$i+1]
        $zipcode = $zipcodes[$i+1]
        endif
        
        
        ; if not exist, add to temp array and increase counter
        If Not CheckIfExist($temp, $lastName, $maidenName, $firstName, $day, $month, $year) Then
            $temp[$count][0] = $lastName
            $temp[$count][1] = $maidenName
            $temp[$count][2] = $firstName
            $temp[$count][3] = $day
            $temp[$count][4] = $month
            $temp[$count][5] = $year
            $temp[$count][6] = $busform
            $temp[$count][7] = $adressnr
            $temp[$count][8] = $zipcode
            $count += 1
        EndIf
    Next
    
    ; store owners in new array with correct size and return
    Local $owners[$count][9]
    For $i = 0 To $count - 1
        $owners[$i][0] = $temp[$i][0]
        $owners[$i][1] = $temp[$i][1]
        $owners[$i][2] = $temp[$i][2]
        $owners[$i][3] = $temp[$i][3]
        $owners[$i][4] = $temp[$i][4]
        $owners[$i][5] = $temp[$i][5]
        $owners[$i][6] = $temp[$i][6]
        $owners[$i][7] = $temp[$i][7]
        $owners[$i][8] = $temp[$i][8]
    Next
    Return $owners
EndFunc 
    
func _IECreate2($xWidth, $xHeight, $hGUI)
$pid = Run(@ProgramFilesDir&"\internet explorer\iexplore.exe -k "&"www.kvk.nl", "", @SW_HIDE)

Sleep(3000)
$hHandle = _ProcessGetHWnd($pid)
GUISetState(@SW_SHOW, $hGUI)


_WinAPI_SetParent($hHandle, $hGUI)
_WinAPI_MoveWindow($hHandle, 520, 30, 500, 650, True)
_WinAPI_SetWindowLong($hHandle, $GWL_STYLE, $WS_POPUP+$WS_VISIBLE)


$oIE = _IEAttach("http://www.kvk.nl/", "URL")


if @error = 7 then
    while @error = 7
        $oIE = _IEAttach("http://www.kvk.nl/", "URL")
    wend
endif

Send("{F5}")

return $hHandle
EndFunc


Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000)
    Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit()
    While 1
      $aWin = WinList($sTitle)
        For $i = 1 To $aWin[0][0]
            If $iPid = WinGetProcess($aWin[$i][1]) Then
                If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then
                    Return $aWin[$i][1]
                ElseIf $iOption = 2 Then
                    ReDim $aReturn[UBound($aReturn) + 1][2]
                    $aReturn[0][0] += 1
                    $aReturn[$aReturn[0][0]][0] = $aWin[$i][0]
                    $aReturn[$aReturn[0][0]][1] = $aWin[$i][1]
                EndIf
            EndIf
        Next
        If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn
        If TimerDiff($hTimer) > $iTimeout Then ExitLoop
        Sleep(Opt("WinWaitDelay"))
    WEnd
       SetError(1)
    Return 0
EndFunc  ;==>_ProcessGetHWnd

func kvknrget($bodytext)
    $nieuwkvknr = stringregexp($bodytext,"KvK-nummer:........",1)
    $nieuwkvknr = stringreplace($nieuwkvknr[0], "KvK-nummer:", "")
    return $nieuwkvknr
endfunc

func getkvklinks($IE)
$teller = 0
$teller2 = 0

$links = $IE.document.links
                For $link In $links
                if $teller > 3 Then
                if $link.outerText <> "Opnieuw zoeken" then 
                    if $link.outerText&"" <> "Totale concern" then
                    $teller2 = $teller2+1
                    endif
                Else
                Exitloop
                endif
                
                endif
                $teller=$teller+1
            Next

local $hrefs[$teller2][2]
$teller3 = 0
$teller4 = 0
$links = $IE.document.links
                For $link In $links
                if $teller3 > 3 Then
                if $link.outerText&"" <> "Opnieuw zoeken"  then
                        if $link.outerText&"" <> "Totale concern" then
                    $kvktemp = Stringreplace($link.href, "https://server.db.kvk.nl/TST-BIN/FU/TSWS001@?BUTT=", "")
                    $hrefs[$teller4][0]=$kvktemp
                    $hrefs[$teller4][1]=$link.outerText
                    $teller4 = $teller4+1
                    endif
                Else
                Exitloop
                endif
                endif
                $teller3 = $teller3+1
            Next        
return $hrefs
endfunc

Func ArrayMerge($amArray1, $amArray2)
    Local $tempArray = $amArray1
    Local $amElements = Ubound($tempArray,1) + Ubound($amArray2,1)
    Redim $tempArray[$amElements][9]
    Local $amCount = 0
    
    For $X = Ubound($amArray1) to $amElements - 1
        $tempArray[$X][0] = $amArray2[$amCount][0]
        $tempArray[$X][1] = $amArray2[$amCount][1]
        $tempArray[$X][2] = $amArray2[$amCount][2]
        $tempArray[$X][3] = $amArray2[$amCount][3]
        $tempArray[$X][4] = $amArray2[$amCount][4]
        $tempArray[$X][5] = $amArray2[$amCount][5]
        $tempArray[$X][6] = $amArray2[$amCount][6]
        $tempArray[$X][7] = $amArray2[$amCount][7]
        $tempArray[$X][8] = $amArray2[$amCount][8]
        $amCount += 1
    Next
    Return $tempArray
EndFunc

func toetsing($owners,$aanvraagnr)

$handlelogi = ""
if processexists("bkr.exe") = 0 then
    run("\\scsrvbkr.santander.local\BKRCLIENT\bkr.exe")
    
    winwait("Inloggen")
    winsetstate("Inloggen","", @SW_hide)
    $handlelogi = wingethandle("LogiLink BKR")
endif

;   winactivate($handlelogi)
;if winactive("Inloggen") then
    ;controlsend("Inloggen","","TMaskEdit2","bkr")
    ;controlsettext("Inloggen","","Edit2","1105000")
    ;controlclick("Inloggen","","TBitBtn2")
;endif

controlclick("LogiLink BKR","","TPanel4","primary", 1, 15, 13)

winactivate("LogiLink BKR")
$BKRCODE = 0
$Form3 = GUICreate("Logilink controle paneel", 340, 490, 208, 190)
$Toetsvorm = GUICtrlCreateGroup("BKR toetsen", 8, 0, 329, 265)
$Button4 = GUICtrlCreateButton("Naam/gebdatum", 16, 224, 105, 25)
$Label4 = GUICtrlCreateLabel("Bovenstaande persoon toetsen op.....", 24, 200, 182, 17)
$Label5 = GUICtrlCreateLabel("Selecteer de persoon die u wilt toetsen", 24, 16, 187, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button5 = GUICtrlCreateButton("Postcode/huisnr", 128, 224, 105, 25)
$Button6 = GUICtrlCreateButton("Beide", 248, 224, 81, 25)
$Button7 = GUICtrlCreateButton("Sla huidige BKR output op", 8, 280, 219, 25)
$Eindoordeel = GUICtrlCreateGroup("Eindoordeel", 8, 312, 305, 180)
$Label1 = GUICtrlCreateLabel("Geef hier je eindoordeel over alle BKR output.", 24, 336, 220, 17)
$Label2 = GUICtrlCreateLabel("Deze score kan verschillen van 1 (goed) tot 4 (slecht)", 24, 352, 256, 17)
$Label3 = GUICtrlCreateLabel("Deze informatie wordt gebruikt in GDM.", 24, 368, 189, 17)
$Combo1 = GUICtrlCreateCombo("1", 24, 392, 105, 25)
guictrlsetdata($combo1, 2)
guictrlsetdata($combo1, 3)
guictrlsetdata($combo1, 4)
$Label3 = GUICtrlCreateLabel("Was er sprake van een EVA pop-up?", 24, 428)
$Combo2 = GUICtrlCreateCombo("Nee", 24, 450, 105, 25)
guictrlsetdata($combo2, "Ja")
$Button8 = GUICtrlCreateButton("Logilink afgerond", 152, 452, 129, 25) 
GUICtrlCreateGroup("", -99, -99, 1, 1)
$List1 = GUICtrlCreateListview("Naam         |Bedrijfsvorm|Geboortedatum|Huisnr|Postcode", 24, 32, 273, 162)
for $d=0 to ubound($owners, 1)-1
GUICtrlCreateListViewItem($owners[$d][0]&" "&$owners[$d][1]&", "&$owners[$d][2]&"|"&$owners[$d][6]&"|"&$owners[$d][3] & "-" & $owners[$d][4] & "-" & $owners[$d][5]&"|"&$owners[$d][7]&"|"&$owners[$d][8], $list1)
next
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
winactivate($handlelogi)
While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    GUIdelete($form3)
                    Exitloop
                Case $button4
                        winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )

                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit11",$goeieitems[1])
                    controlsettext("Persoon toetsing","","TMaskEdit9",$item[3])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                    
                Case $button5
                    winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit7",$item[4])
                    controlsettext("Persoon toetsing","","TMaskEdit8",$item[5])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck","")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                    
                Case $button6
                    winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )
                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit11",$goeieitems[1])
                    controlsettext("Persoon toetsing","","TMaskEdit9",$item[3])
                    controlsettext("Persoon toetsing","","TMaskEdit7",$item[4])
                    controlsettext("Persoon toetsing","","TMaskEdit8",$item[5])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                
            Case $button7
                winactivate ("LogiLink BKR")
                $handle = wingethandle("LogiLink BKR")
                $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                $goeieitems = StringSplit ( $item[1], "," )
                $naam = $goeieitems[1]
                bkropslaan($handle, $aanvraagnr, $naam)
            
            Case $button8
                    $EVAhit = guictrlread ($combo2)
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )
                    $naam = $goeieitems[1]
                    If $EVAhit = "Ja" then 
                        evahit ($naam,$aanvraagnr)
                    Endif
                    $BKRCODE = guictrlread($Combo1)
                    
                    guidelete($form3)
                    winactivate("Mercury")
                    Exitloop
                EndSwitch
                
            WEnd
            ProcessClose ( "bkr.exe")

    return $BKRCode

endfunc
Func bkropslaan ($handle, $aanvraagnr, $naam)
    $posarray = ControlGetpos ($handle, "", "TListBox1")
    winactivate($handle)
    winwaitactive($handle)
    DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$naam)
    _ScreenCapture_CaptureWnd("N:\Auto IT\Development\"&$aanvraagnr&"\"&$naam&"\BKR"&$naam&".jpg", $handle, $posarray[0]+5, $posarray[1]+45, $posarray[0]+$posarray[2], $posarray[1]+$posarray[3], false)
    Winactivate ("Logilink controle paneel")
RETURN
EndFunc

func bkrreadycheck($handle)
    
    while hex(pixelgetcolor(691, 545, $handle)) <> "00008000"
        sleep(10)
    wend
    while hex(pixelgetcolor(691, 545, $handle)) <> "00D4D0C8"
        sleep(100)
    wend
RETURN
endfunc
func evahit ($klantnaam, $aanvraagnr)
DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam)
FileCopy ( @scriptdir&"\evahit.bmp", "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\")
EndFunc

func writefile($aanvraagnr, $klantnaam, $site, $IE)

DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam)
FileOpen ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\"&$site&$klantnaam&".htm",8)
$tekst = _IEBodyReadHTML($IE)
$gelukt = filewrite("N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\"&$site&$klantnaam&".htm",$tekst)
If $gelukt <> "1" Then
    Msgbox (0, "Let op!", "Het opslaan van de output van "&$site&" is niet gelukt. Zorg dat je deze informatie alsnog opslaat.")
Endif
endfunc

func writecompanyfile($aanvraagnr,$site, $IE)

DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\")
FileOpen ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$site&".htm",8)
$gelukt = filewrite("N:\Auto IT\Development\"&$aanvraagnr&"\"&$site&".htm",_IEBodyReadHTML($IE))
If $gelukt <> "1" Then
    Msgbox (0, "Let op!", "Het opslaan van de output van "&$site&" is niet gelukt. Zorg dat je deze informatie alsnog opslaat.")
Endif
endfunc

func kvkhistorie ($kvknr,$aanvraagnr)
    $kvkarray = stringsplit ($kvknr, "")
    _IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/RB/RBHRH01@?BUTT=H|"&$kvkarray[1]&$kvkarray[2]&"|"&$kvkarray[3]&$kvkarray[4]&$kvkarray[5]&$kvkarray[6]&$kvkarray[7]&$kvkarray[8]&"|||0|0")
    $kvkhistoriereturn = _IEBodyReadHTML ($oIE)
     $historieaanwezig = StringRegExp($kvkhistoriereturn, "Geen handelsregisterhistorie")
     Local $returnarray [2]
     If $historieaanwezig = "1" then 
    $returnarray [0] = "geen"
     Else 
        $returnarray [0] = "wel"
    Endif
    $returnarray[1] = $kvkhistoriereturn
    writecompanyfile ($aanvraagnr, "KVK historie", $oIE)
    Return $returnarray
Endfunc

Func allesnaaracces ($offertenr, $aanvraagnr,$datumaanvraag ,$dealernaam,$verkoper,$telefoon,$aanvrager,$kvknr,$kontaktpersoon,$telefoon2, $automerk,$autotype, $looptijd,$oudofnieuw,$contractsoort, $verkoopprijs, $inzetbedrag, $leasetarief, $rob, $hsb, $verzekering, $vervoer,$brandstof,$bijafbin = "",$dealernr = "",$aktie = "",$aanbetaling="",$bpmtekst ="",$kmstand = "", $overname = "", $bijklant = "",$slottermijn = "",$debiteurnr = "",$tussenpersoon="" , $opmerking = "",$mobiel = "",$accountant= "",$kontaktpersoon2 = "",$telefoon3 = "")
If ProcessExists ("Kredietaanvraag.exe")Then
    sleep (1)
    Else
    Run ("\\scsrvfps01\datastore_scnl\Kredietaanvraag\Kredietaanvraag.exe")
Endif
WinActivate ("Aanvraaggegevens")
Winwaitactive ("Aanvraaggegevens")
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:29]", $offertenr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:30]", $aanvraagnr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:31]", $debiteurnr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:32]", $datumaanvraag)

ControlCommand ( "Aanvraaggegevens", "", 56, "SelectString", $bijklant) 
ControlCommand ( "Aanvraaggegevens", "", 46, "SelectString",$bijafbin)

ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:28]", $dealernr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:27]", $dealernaam)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:26]", $verkoper)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:25]", $telefoon)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:24]", $aanvrager)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:23]", $kvknr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:22]", $kontaktpersoon)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:21]", $telefoon2)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:20]", $mobiel)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:19]", $accountant)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:18]", $kontaktpersoon2)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:17]", $telefoon3)

ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:15]", $automerk)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:14]", $autotype)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:13]", $looptijd)
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:12]", $km)
    If $oudofnieuw = "Gebruikt" then 
    ControlCommand ( "Aanvraaggegevens", "", 26, "SelectString", $oudofnieuw)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:11]", $datumdeel1)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:10]", $kmstand)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:9]", $kenteken)
    Else 
    ControlCommand ( "Aanvraaggegevens", "", 26, "SelectString", $oudofnieuw)
    Endif
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6ComboBox; INSTANCE:3]", $aktie)
ControlCommand ( "Aanvraaggegevens", "", 23, "SelectString",$contractsoort)

    ;If $BPM = "1" then 
    ;ControlCommand ( "Aanvraaggegevens", "BPM", 14, "check")
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:1]", $bpmtext)
    ;Endif
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:8]", $verkoopprijs)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:7]", $aanbetaling)
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:12]", $km)
    If $contractsoort = "FL" Then
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:6]", $aanbetaling)
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:5]", $overname)
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:3]", $slottermijn)
    EndIf
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:4]", $inzetbedrag)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:2]", $leasetarief)

    If $ROB = "1" then 
    ControlCommand ( "Aanvraaggegevens", "ROB", 11, "check")
    Endif
    If $HSB = "1" then 
    ControlCommand ( "Aanvraaggegevens", "HSB", 10, "check")
    Endif
    If $verzekering = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Verzekering", 9, "check")
    Endif
    If $brandstof = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Brandstof", 8, "check")
    Endif
    If $vervoer = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Verv. vervoer", 7, "check")
    Endif
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6ComboBox; INSTANCE:1]", $tussenpersoon).
If $opmerking <> "" Then

ControlClick("Aanvraaggegevens", "", 2)
ControlSetText("Opmerking toevoegen", "", "[CLASS:ThunderRT6TextBox; INSTANCE:1]", $opmerking)
ControlClick("Opmerking toevoegen", "", "ThunderRT6CommandButton1")
Endif
;ControlClick("Aanvraaggegevens", "", "ThunderRT6CommandButton3")
Return

EndFunc

Func wisplaatjes ()
    GUICtrlSetState ( $kvkconcerngoed, $GUI_HIDE)
    GUICtrlSetState ($kvkuitrekselgoed , $GUI_HIDE)
GUICtrlSetState ( $kvkhistoriegoed, $GUI_HIDE)
GUICtrlSetState ( $accesgoed, $GUI_HIDE)
GUICtrlSetState ( $kvkgdmgoed, $GUI_HIDE)
GUICtrlSetState ( $dealergoed, $GUI_HIDE)
GUICtrlSetState ( $kvkhistorieslecht, $GUI_HIDE)
GUICtrlSetState ( $kvkuitrekselslecht, $GUI_HIDE)
GUICtrlSetState ($graydonslecht, $GUI_HIDE)

GUICtrlSetState ( $gdmslecht, $GUI_HIDE)
GUICtrlSetState ($dealerslecht, $GUI_HIDE)
GUICtrlSetState ($geenconcern, $GUI_HIDE)
GUICtrlSetState ($bkrgeencodes, $GUI_HIDE)
GUICtrlSetState ($bkrwelcodes, $GUI_HIDE)
GUICtrlSetState ($evageen, $GUI_HIDE)
GUICtrlSetState ($evawel, $GUI_HIDE)
GUICtrlSetState ($graydongeen, $GUI_HIDE)
GUICtrlSetState ($graydonwel, $GUI_HIDE)
GUICtrlSetState ($gdmaccept, $GUI_HIDE)
GUICtrlSetState ($gdmpending, $GUI_HIDE)
GUICtrlSetState ($gdmreject, $GUI_HIDE)
Endfunc

Func wisinvoer ()
    Guictrlsetdata ($aanvraagnr, "")
    Guictrlsetdata ($debitnr, "")
    Guictrlsetdata ($offertenr, "")
    Guictrlsetdata ($dealernaam, "")
    Guictrlsetdata ($verkoper, "")
    Guictrlsetdata ($bijafbin, "Uitbreiding")
    Guictrlsetdata ($bijklant, "Uitbreiding")
    Guictrlsetdata ($dealernr, "")
    Guictrlsetdata ($dealertel, "")
    Guictrlsetdata ($aanvrager, "")
    Guictrlsetdata ($kvknummer, "")
    Guictrlsetdata ($telefoon, "")  
    Guictrlsetdata ($contactpers, "")
    Guictrlsetdata ($mobiel, "")    
    Guictrlsetdata ($accountant, "")    
    Guictrlsetdata ($accounttel, "")
    Guictrlsetdata ($automerk, "")
    Guictrlsetdata ($looptijd, "")
    Guictrlsetdata ($newauto, "Nieuw")
    Guictrlsetdata ($autotype, "")
    GUICtrlSetData ($datdeel1, "")
    Guictrlsetdata ($actie, "")
    Guictrlsetdata ($kmstand, "")
    Guictrlsetdata ($kenteken, "")
    Guictrlsetdata ($contracttype, "")
    Guictrlsetdata ($verkoopprijs, "")
    Guictrlsetdata ($aanbet, "")
    Guictrlsetdata ($inruil, "")
    Guictrlsetdata ($overnamebijfl, "")
    Guictrlsetdata ($inzet, "")
    Guictrlsetdata ($slotterm, "")
    Guictrlsetdata ($leasetarief, "")
    Guictrlsetdata ($rob, "Nee")
    Guictrlsetdata ($hsb, "Nee")
    Guictrlsetdata ($verzekering, "Nee")
    Guictrlsetdata ($brandstof, "Nee")
    Guictrlsetdata ($vervoer, "Nee")
    Guictrlsetdata ($opmerking, "")
EndFunc
Edited by Rigest

Share this post


Link to post
Share on other sites
AdmiralAlkex

Why don't you start by fixing the twelve errors you get?

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(290,9) : ERROR: missing EndSelect.

Func

~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(281,15) : REF: missing EndSelect.

Select

~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(290,9) : ERROR: missing Wend.

Func

~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(278,1) : REF: missing Wend.

While

^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(397,13) : ERROR: syntax error

Case

~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(258,38) : ERROR: _IECreate2(): undefined function.

$handle = _IECreate2(630, 650, $Form1)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(286,24) : ERROR: wisinvoer(): undefined function.

wisinvoer ()

~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(291,30) : ERROR: wisplaatjes(): undefined function.

wisplaatjes ()

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(366,49) : ERROR: kvk(): undefined function.

$owners = kvk($kvknr,$aanvraagnr)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(367,61) : ERROR: kvkhistorie(): undefined function.

$historie = kvkhistorie ($kvknr, $aanvraagnr)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(368,56) : ERROR: toetsing(): undefined function.

$BKRCODE = toetsing($owners,$aanvraagnr)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(370,54) : ERROR: graydonall(): undefined function.

$uitslag = graydonall($owners, $kvknr)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(387,42) : ERROR: GDM(): undefined function.

GDM($kvknr, $gdmarray)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3(392,393) : ERROR: allesnaaracces(): undefined function.

allesnaaracces ($offertenr, $aanvraagnr,$datumaanvraag ,$dealernaam,$verkoper,$telefoon,$aanvrager,$kvknr,$kontaktpersoon,$telefoon2, $automerk,$autotype, $looptijd,$oudofnieuw,$contractsoort, $verkoopprijs, $inzetbedrag, $leasetarief, $rob, $hsb, $verzekering, $vervoer,$brandstof, $bijafbin, $dealernr, $aktie,$aanbetaling,"","", "", "", "", "","" , $opmerking , "","", "","")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Admiral\AutoIt TNG\Från forumet\373.au3 - 12 error(s), 0 warning(s)

1. Fix first error

2. Run again.

3. If more errors GoTo 1.

Because the first error throws off AU3Check so most after that can't be trusted.

You are running from SciTE so you get all the extra tools and niceties, right?

Also install SciTE4AutoIt3 if you haven't. Follow the link and read about the features to see why :)

Share this post


Link to post
Share on other sites
Rigest

Why don't you start by fixing the twelve errors you get?

1. Fix first error

2. Run again.

3. If more errors GoTo 1.

Because the first error throws off AU3Check so most after that can't be trusted.

You are running from SciTE so you get all the extra tools and niceties, right?

Also install SciTE4AutoIt3 if you haven't. Follow the link and read about the features to see why ;)

Admiral, tnx for your reply. I placed a function wrong which caused all the errors. The below script doesn't have any errors, but I still have the problems with the variables :). Most of the variables changes to zero (which means they can't be read I assume).

#include <IE.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <Constants.au3>
#Include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <ScreenCapture.au3>


$Form1 = GUICreate("Mercury", 1275, 965, 0, 0)
GUISetBkColor(0xFFFFFF)
$oIE = ObjCreate("Shell.Explorer.2")
$oIE2 = ObjCreate("Shell.Explorer.2")
$oIE3 = ObjCreate("Shell.Explorer.2")
$handlelogi = ""
;Alle stappen die doorlopen worden

$statusgroep = Guictrlcreategroup ("Voortgang", 1020, 10, 350, 650)
$labelkvkinlog = guictrlcreatelabel("Concernrelaties", 1025, 28)
$labelkvkuitreksel = guictrlcreatelabel("KVK uitreksel ophalen", 1025, 48)
$labelkvkhistorie = guictrlcreatelabel("KVK historie ophalen", 1025, 68)


$labelbkr = guictrlcreatelabel("BKR raadplegen", 1025, 108)
$labeleva = guictrlcreatelabel("EVA raadplegen", 1025, 128)
$labelgraydon = guictrlcreatelabel("Graydon raadplegen", 1025, 148)

$labelgdm = guictrlcreatelabel("GDM raadplegen", 1025, 188)
$labeldealer = guictrlcreatelabel("Dealer geïnformeerd", 1025, 208)

$mercuryplaatje = GUICtrlCreatePic(@scriptdir&"\mercury.bmp", 1100, 500)
;stappen zijn gelukt
$kvkconcerngoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 23,20,20)
GUICtrlSetState ( $kvkconcerngoed, $GUI_HIDE)
$kvkuitrekselgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 43,20,20)
GUICtrlSetState ($kvkuitrekselgoed , $GUI_HIDE)
$kvkhistoriegoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 63,20,20)
GUICtrlSetState ( $kvkhistoriegoed, $GUI_HIDE)


$accesgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 163,20,20)
GUICtrlSetState ( $accesgoed, $GUI_HIDE)
$kvkgdmgoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 183,20,20)
GUICtrlSetState ( $kvkgdmgoed, $GUI_HIDE)
$dealergoed = GUICtrlCreatePic(@scriptdir&"\check.bmp", 1248, 203,20,20)
GUICtrlSetState ( $dealergoed, $GUI_HIDE)

;stappen zijn mislukt

$kvkhistorieslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 63,20,20)
GUICtrlSetState ( $kvkhistorieslecht, $GUI_HIDE)
$kvkuitrekselslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 43,20,20)
GUICtrlSetState ( $kvkuitrekselslecht, $GUI_HIDE)


$graydonslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 143,20,20)
GUICtrlSetState ($graydonslecht, $GUI_HIDE)
$gdmslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 183,20,20)
GUICtrlSetState ( $gdmslecht, $GUI_HIDE)
$dealerslecht = GUICtrlCreatePic(@scriptdir&"\red x.bmp", 1248, 203,20,20)
GUICtrlSetState ($dealerslecht, $GUI_HIDE)

;speciale meldingen
$geenconcern = guictrlcreatelabel("Niet aanwezig", 1025, 88)
GUICtrlSetState ($geenconcern, $GUI_HIDE)
$bkrgeencodes = guictrlcreatelabel("Geen BKR coderingen", 1150, 108)
GUICtrlSetState ($bkrgeencodes, $GUI_HIDE)
$bkrwelcodes = guictrlcreatelabel("BKR coderingen", 1150, 108)
GUICtrlSetState ($bkrwelcodes, $GUI_HIDE)
$evageen = guictrlcreatelabel("Geen EVA melding", 1150, 128)
GUICtrlSetState ($evageen, $GUI_HIDE)
$evawel = guictrlcreatelabel("EVA melding", 1150, 128)
GUICtrlSetState ($evawel, $GUI_HIDE)
$graydongeen = guictrlcreatelabel("Geen Graydon melding", 1150, 148)
GUICtrlSetState ($graydongeen, $GUI_HIDE)
$graydonwel = guictrlcreatelabel("Graydon melding", 1150, 148)
GUICtrlSetState ($graydonwel, $GUI_HIDE)
$gdmaccept = guictrlcreatelabel("Geaccepteerd", 1150, 188)
GUICtrlSetState ($gdmaccept, $GUI_HIDE)
$gdmpending = guictrlcreatelabel("Pending", 1150, 188)
GUICtrlSetState ($gdmpending, $GUI_HIDE)
$gdmreject = guictrlcreatelabel("Geweigerd", 1150, 188)
GUICtrlSetState ($gdmreject, $GUI_HIDE)

;Start GUI
$Label1 = GUICtrlCreateLabel("Offerte nummer      :", 8, 24, 132, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label2 = GUICtrlCreateLabel("Aanvraag nummer  :", 8, 56, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Debiteur nummer  :", 237, 24, 127, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$offertenr = GUICtrlCreateInput("", 144, 24, 65, 21)
$aanvraagnr = GUICtrlCreateInput("", 144, 56, 65, 21)
$debitnr = GUICtrlCreateInput("", 376, 24, 65, 21)
$Group1 = GUICtrlCreateGroup("Kredietaanvraag gegevens", 0, 8, 473, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Algemene gegevens", 0, 104, 473, 81)
$Date1 = GUICtrlCreateDate(@year&"/"&@mon&"/"&@MDAY&" "&@Hour&":"&@Min&":"&@SEC, 144, 128, 138, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$bijklant = GUICtrlCreateCombo("Uitbreiding", 144, 152, 81, 21)
GUICtrlSetData(-1,"Vervanging")
$Label4 = GUICtrlCreateLabel("Datum aanvraag     :", 8, 128, 133, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label5 = GUICtrlCreateLabel("Bij klant                  :", 8, 154, 132, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Behandelaar  :", 291, 128, 98, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label7 = GUICtrlCreateLabel("Bij Afbin          :", 288, 152, 102, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Behandelaar = GUICtrlCreateInput(@Username, 392, 128, 65, 21)
$bijafbin = GUICtrlCreateCombo("Uitbreiding", 392, 152, 65, 21)
GUICtrlSetData(-1,"Vervanging")
$Group3 = GUICtrlCreateGroup("Aanvrager gegevens", 0, 280, 473, 153)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label8 = GUICtrlCreateLabel("Aanvrager (bedrijf)  :", 8, 304, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label9 = GUICtrlCreateLabel("KVK nummer           :", 8, 328, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label10 = GUICtrlCreateLabel("Contactpersoon       :", 8, 352, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label11 = GUICtrlCreateLabel("Telefoon                  :", 8, 376, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label12 = GUICtrlCreateLabel("Mobiel                     :", 8, 400, 135, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label13 = GUICtrlCreateLabel("Accountant        :", 248, 352, 111, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label14 = GUICtrlCreateLabel("Telefoon            :", 248, 376, 112, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$dealernaam = GUICtrlCreateInput("", 150, 216, 65, 21)
$verkoper = GUICtrlCreateInput("", 150, 240, 65, 21)
$dealernr = GUICtrlCreateInput("", 390, 216, 65, 21)
$dealertel = GUICtrlCreateInput("", 390, 240, 65, 21)
$aanvrager = GUICtrlCreateInput("", 152, 304, 65, 21)
$kvknummer = GUICtrlCreateInput("", 152, 328, 65, 21)
GuiCtrlSetLimit ($kvknummer, 8,8)
$contactpers = GUICtrlCreateInput("", 152, 352, 65, 21)
$telefoon = GUICtrlCreateInput("", 152, 376, 65, 21)
$mobiel = GUICtrlCreateInput("", 152, 400, 65, 21)
$accountant = GUICtrlCreateInput("", 368, 352, 65, 21)
$accounttel = GUICtrlCreateInput("", 368, 376, 65, 21)
$Group4 = GUICtrlCreateGroup("Dealer gegevens", 0, 192, 473, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label15 = GUICtrlCreateLabel("Dealer-naam           :", 8, 216, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label16 = GUICtrlCreateLabel("Verkoper                 :", 8, 240, 134, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label17 = GUICtrlCreateLabel("Dealer nummer          :", 243, 216, 147, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label18 = GUICtrlCreateLabel("Telefoon                     :", 242, 240, 148, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Group5 = GUICtrlCreateGroup("Object gegevens", 0, 436, 473, 153)
$Group6 = GUICtrlCreateGroup("Indien gebruikt", 240, 456, 217, 129)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label19 = GUICtrlCreateLabel("Automerk                  :", 8, 460, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label20 = GUICtrlCreateLabel("Autotype                   :", 8, 484, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label21 = GUICtrlCreateLabel("Looptijd                    :", 8, 508, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label22 = GUICtrlCreateLabel("Nieuwe auto (ja/nee):", 8, 532, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUICtrlSetTip(-1, "8")
$Label23 = GUICtrlCreateLabel("Actie                        :", 12, 556, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$automerk = GUICtrlCreateInput("", 156, 460, 65, 21)
$autotype = GUICtrlCreateInput("", 156, 484, 65, 21)
$looptijd = GUICtrlCreateInput("", 156, 508, 65, 21)
$newauto = GUICtrlCreateCombo("Nieuw", 156, 532, 65, 21)
GUICtrlSetData(-1,"Gebruikt")
$actie = GUICtrlCreateCombo("", 156, 556, 65, 21)
GUICtrlSetData(-1,"H2000|Mail|Anders")
$datdeel1 = GUICtrlCreateCombo("", 374, 475, 65, 21)
GUICtrlSetData(-1,"0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40")
$Label24 = GUICtrlCreateLabel("Leeftijd in jr      :", 252, 475, 120, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$kmstand = GUICtrlCreateInput("", 374, 505, 65, 21)
$Label25 = GUICtrlCreateLabel("Kilometerafstand :", 254, 505, 120, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$kenteken = GUICtrlCreateInput("", 374, 542, 65, 21)
$Label26 = GUICtrlCreateLabel("Kenteken            :", 254, 542, 116, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Group7 = GUICtrlCreateGroup("Contract gegevens", 0, 592, 505, 229)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label27 = GUICtrlCreateLabel("Contract type           :", 8, 616, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label28 = GUICtrlCreateLabel("Verkoopprijs            €", 8, 640, 139, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label29 = GUICtrlCreateLabel("Aanbetaling             €", 8, 664, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label30 = GUICtrlCreateLabel("Inruil                        €", 8, 688, 140, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label31 = GUICtrlCreateLabel("Overname bij FL      €", 8, 712, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label32 = GUICtrlCreateLabel("(excl. btw)", 228, 640, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$contracttype = GUICtrlCreateCombo("", 156, 616, 65, 21)
GUICtrlSetData(-1,"OL|FL|LV")
$verkoopprijs = GUICtrlCreateInput("", 156, 640, 65, 21)
$aanbet = GUICtrlCreateInput("", 156, 664, 65, 21)
$inruil = GUICtrlCreateInput("", 156, 688, 65, 21)
$overnamebijfl = GUICtrlCreateInput("", 156, 712, 65, 21)
$Label34 = GUICtrlCreateLabel("(excl. btw)", 228, 667, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label35 = GUICtrlCreateLabel("(excl. btw)", 228, 691, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label36 = GUICtrlCreateLabel("(excl. btw)", 228, 715, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$inzet = GUICtrlCreateInput("", 156, 744, 65, 21)
$Label47 = GUICtrlCreateLabel("Inzetbedrag             €", 8, 744, 145, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label37 = GUICtrlCreateLabel("_____________", 152, 728, 82, 17)
$slotterm = GUICtrlCreateInput("", 156, 769, 65, 21)
$Label38 = GUICtrlCreateLabel("Slottermijn bij FL     €", 8, 769, 145, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label39 = GUICtrlCreateLabel("(excl. btw)", 231, 775, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$leasetarief = GUICtrlCreateInput("", 156, 795, 65, 21)
$Label40 = GUICtrlCreateLabel("Leasetarief p.m.      €", 8, 795, 141, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label33 = GUICtrlCreateLabel("Verv. Vervoer", 334, 764, 91, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label41 = GUICtrlCreateLabel("Brandstof", 334, 735, 64, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label42 = GUICtrlCreateLabel("Verzekering", 334, 706, 81, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label43 = GUICtrlCreateLabel("HSB", 334, 678, 31, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Label44 = GUICtrlCreateLabel("ROB", 334, 649, 32, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$rob = GUICtrlCreateCombo("Nee", 428, 648, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$hsb = GUICtrlCreateCombo("Nee", 428, 679, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$verzekering = GUICtrlCreateCombo("Nee", 428, 708, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$brandstof = GUICtrlCreateCombo("Nee", 428, 738, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$vervoer= GUICtrlCreateCombo("Nee", 428, 767, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Ja|Nee")
$opmerking = GUICtrlCreateEdit("", 8, 836, 497, 61)
$whatitdo = GUICtrlCreateGroup("Opmerkingen", 0, 820, 505, 93)

$Button1 = GUICtrlCreateButton("Start onderzoek", 32, 920, 137, 33)
$Button2 = GUICtrlCreateButton("Wis alle invoer", 252, 920, 137, 33)
$Label45= GUICtrlCreateLabel("Bedrijfsvorm:", 527, 720)
$Label46 = GUICtrlCreateLabel("Eigenaren:", 527, 770)
$busform = GUICtrlCreateInput("", 527, 740, 300, 21)

$listview = GUICtrlCreateListView("Naam                         |Bedrijf                        |Bedrijfsvorm                  |Geboortedatum", 527, 785, 500, 100)
$naam1 = GUICtrlCreateList("", 527, 785, 300, 100)
$handle = _IECreate2(630, 650, $Form1)
Winsetstate($handle, "", @SW_SHOW)

$tab = GUICtrlCreateTab(510, 5, 500, 680)
$tab3 = GUICtrlCreateTabItem("KvK")
$KVK = GUICtrlCreateObj($oIE, 520, 30, 500, 650)
$tab1 = GUICtrlCreateTabItem("Graydon")
$Graydon = GUICtrlCreateObj($oIE2, 520, 30, 500, 650)
$tab2 = GUICtrlCreateTabItem("GDM")
$GDM = GUICtrlCreateObj($oIE3, 520, 30, 500, 650)




$oIE.navigate("www.kvk.nl")
$oIE2.navigate("https://mijn.graydon.nl/wps/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3iTEB_34BAzYwN3n1AnAyMfE79gI2cfAwNjY6B8pFm8n79RqJuJp6GhhZmroYGRmYeJk0-Yp4G7izEB3X4e-bmp-gW5EeUABb6wHQ!!/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfNFRMR1NUNjMwR0xVQjAyTDROUzJDTDAwTjQ!/?menulink=1")
$oIE3.navigate("https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GuiGetMsg()
   
        Select;select the button
        Case $msg = $GUI_EVENT_CLOSE
            Exit
            
        Case $msg = $Button2
        wisinvoer ()
            
        Case $msg = $Button1
        executeit ()

        Case $msg = $tab
                $tabnr = Guictrlread($tab)
                if $tabnr = 0 Then
                Winsetstate($handle, "", @SW_SHOW)  
                Else
                Winsetstate($handle, "", @SW_HIDE)  
                endif
        
        EndSelect ; endselect gui

WEnd
Exit

        Func executeit () ;start executing
                wisplaatjes ()
                            
                $kvknr = Guictrlread($kvknummer)
                $gevonden = 0
                _IEloadwait($oIE)
                Winsetstate($handle, "", @SW_SHOW)  
                GUICtrlSetState ( $tab3, $GUI_SHOW)
                GUIctrlsetdata($busform,"")
                _GUICtrlListView_DeleteAllItems($listview)
                $offertenr = Guictrlread ($offertenr)
                $aanvraagnr = Guictrlread ($aanvraagnr) 
                $debiteurnr = Guictrlread ($debitnr)
                $datumaanvraag = Guictrlread ($Date1)
                $bijklant = Guictrlread ($bijklant)
                $bijafbin = Guictrlread ($bijafbin)
                $dealernr = Guictrlread ($dealernr)
                $dealernaam = Guictrlread ($dealernaam)
                $verkoper = GUICtrlRead ($verkoper)
                $telefoon = Guictrlread ($dealertel)
                $aanvrager = Guictrlread ($aanvrager)
                $kontaktpersoon = Guictrlread ($contactpers)
                $telefoon2 = Guictrlread ($telefoon)
                $mobiel = GUICtrlRead ($mobiel)
                $accountant = GUICtrlRead ($accountant)
                $telefoon3 = Guictrlread ($accounttel)
                $looptijd = Guictrlread ($looptijd) 
            ;   $km = 
                $oudofnieuw = guictrlread ($newauto)
                $aktie = guictrlread ($actie)
                $contractsoort = guictrlread ($contracttype)
            ;   $bpm 
            ;   $bpmtekst
                $verkoopprijs = Guictrlread ($verkoopprijs)
                $aanbetaling = Guictrlread ($aanbet)
                $overname = Guictrlread ($overnamebijfl)
                $slottermijn = Guictrlread ($slotterm)
                $inzetbedrag = Guictrlread ($inzet)
                $leasetarief = Guictrlread ($leasetarief)
                $rob1 = Guictrlread ($rob)
                $hsb1 = Guictrlread ($hsb)
                $verzekering1= Guictrlread ($verzekering)
                $brandstof1 = guictrlread ($brandstof)
                $vervoer1 = guictrlread ($vervoer)
                $kmstand = Guictrlread ($kmstand)
                $kenteken = Guictrlread ($kenteken)
                $automerk = Guictrlread ($automerk)
                $autotype = Guictrlread ($autotype)
                $opmerking = Guictrlread ($opmerking)
                
                Msgbox (0, "", $aanvraagnr)
                Msgbox (0, "", $contracttype)
                Msgbox (0, "", $dealernr)
                Msgbox (0, "", $accountant)
                Msgbox (0, "", $telefoon3)
                If $rob1 = "Ja" then 
                    $rob = "1"
                else 
                $rob = "0"
                EndIf
                If $hsb1 = "Ja" then 
                $hsb = "1"
                else 
                $hsb = "0"
                EndIf
                If $verzekering1 = "Ja" then 
                $verzekering = "1"
                else 
                $verzekering = "0"
                EndIf
                If $brandstof1 = "Ja" then 
                $brandstof = "1"
                else 
                $brandstof = "0"
                EndIf
                If $vervoer1 = "Ja" then 
                $vervoer = "1"
                else 
                $vervoer = "0"
                EndIf
                
                $owners = kvk($kvknr,$aanvraagnr)
                $historie = kvkhistorie ($kvknr, $aanvraagnr)
                $BKRCODE = toetsing($owners,$aanvraagnr)
                if $BKRCODE <> "4" then 
                $uitslag = graydonall($owners, $kvknr)
                    if $uitslag = "Reject" then
                    GUICtrlSetState ( $graydonwel, $GUI_SHOW)
                    elseif $uitslag = "Accept" then 
                    GUICtrlSetState ( $graydongeen, $GUI_SHOW)
                    local $gdmarray[10] 
                    $gdmarray[0] = $aanvraagnr
                    $gdmarray[1] = $dealernr
                    $gdmarray[2] = $verkoopprijs
                    $gdmarray[3] = $inzetbedrag
                    $gdmarray[4] = $slottermijn
                    $gdmarray[5] = $looptijd
                    $leeftijd = 0
                    if GUICtrlread($datdeel1) <> "" then $leeftijd = GUICtrlread($datdeel1)
                    $gdmarray[6] = $leeftijd
                    $gdmarray[7] = 1
                    $gdmarray[9] = 1
                    GDM($kvknr, $gdmarray)
                    
                    endif
                            
                endif
            allesnaaracces ($offertenr, $aanvraagnr,$datumaanvraag ,$dealernaam,$verkoper,$telefoon,$aanvrager,$kvknr,$kontaktpersoon,$telefoon2, $automerk,$autotype, $looptijd,$oudofnieuw,$contractsoort,  $verkoopprijs, $inzetbedrag, $leasetarief, $rob, $hsb, $verzekering, $vervoer,$brandstof, $bijafbin, $dealernr, $aktie,$aanbetaling,"","",  "",  "", "", "","" , $opmerking , "","", "","")
        Endfunc ; einde execute

func kvk($kvknr,$aanvraagnr)
    ;GUICtrlSetState ( $tab0, $GUI_SHOW)
    _IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/FU/TSWS001@?BUTT="&$kvknr&"0000")
    $gevonden = 0
    $links = $oIE.document.links
                For $link In $links
                if $link.outerText&"" = "Concernrelaties" then 
                    $gevonden = 1
                    $kliklink = $link
                    
                endif
            Next
    

    if $gevonden = 1 Then
    $kliklink.click
    _IEloadwait($oIE)
        writecompanyfile($aanvraagnr,"KVK concern relaties", $oIE)
        GUICtrlSetState ( $kvkhistoriegoed, $GUI_SHOW)
    ;_IELinkClickByIndex($oIE, 4)
    ;_IEloadwait($oIE)
    

    $topconcernsnrs = getkvklinks($oIE)
    ;_IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/FP/MDWS002@?BUTT=H"&$kvknr&"0000",0)
    ;While $oIE.Document.URL <> "https://server.db.kvk.nl/TST-BIN/FP/MDWS002@?BUTT=H"&$kvknr&"0000" AND winexists("Verbinding met server.db.kvk.nl maken") = 0
    ;Sleep(100)
    ;WEnd
    ;if winexists("Verbinding met server.db.kvk.nl maken") = 1 then
    ;   controlsend("Verbinding met server.db.kvk.nl maken","","Edit2","WWWQGiu8")
    ;   controlsend("Verbinding met server.db.kvk.nl maken","","Edit3","utrecht")
    ;   controlclick("Verbinding met server.db.kvk.nl maken","","Button2")
    ;endif
    ;_IEloadwait($oIE)
    ;_IElinkclickbyindex($oIE,1)
    ;_IEloadwait($oIE)
    GUICtrlSetState ( $kvkconcerngoed, $GUI_SHOW)
    ;$kvknr = kvknrget($oIE.Document.body.innerText)
    else 
    local $eenconcern[1][2]
    $eenconcern[0][0] = $kvknr
    $topconcernsnrs = $eenconcern
    GUICtrlSetState ( $geenconcern, $GUI_SHOW)
    endif

    local $totalowners[1][6]
    for $a=0 to ubound($topconcernsnrs,1)-1
    _IEnavigate($oIE,"https://server.db.kvk.nl/TST-BIN/RB/RBWWW06@?BUTT="&$topconcernsnrs[$a][0]&"0000&amp;JANE=TWDE",0)
    While $oIE.Document.URL <> "https://server.db.kvk.nl/TST-BIN/RB/RBWWW06@?BUTT="&$topconcernsnrs[$a][0]&"0000&amp;JANE=TWDE" AND winexists("Verbinding met server.db.kvk.nl maken") = 0
    Sleep(100)
    WEnd
    if winexists("Verbinding met server.db.kvk.nl maken") = 1 then
        controlsend("Verbinding met server.db.kvk.nl maken","","Edit2","WWWQGiu8")
        controlsend("Verbinding met server.db.kvk.nl maken","","Edit3","utrecht")
        controlclick("Verbinding met server.db.kvk.nl maken","","Button2")
    endif

    _IEloadwait($oIE)
    
    If $oIE.Document.URL = "https://server.db.kvk.nl/wwwsrvu/html/fout1002.htm" then
    GUICtrlSetState ( $kvkuitrekselslecht, $GUI_SHOW)
    Msgbox (0, "Foutmelding", "Mercury heeft geen uitreksel kunnen vinden en zal nu afsluiten. Mocht er wel een uitreksel zijn meld dit probleem a.u.b. bij de beheerders")
    else
    GUICtrlSetState ( $kvkuitrekselgoed, $GUI_SHOW)
    $content = $oIE.Document.body.innerText 
    writecompanyfile($aanvraagnr,"Kvk uitreksel", $oIE)

    $businessForm = GetBusinessForm($content)
    If $businessForm == "" Then
        MsgBox(4096, "Error", "No business form found")
        Return
    Else
        GUICtrlsetdata($busform, $businessForm)
    EndIf
    
    $owners = GetOwnerArray($content)
    

    if $a = 0 Then
        $totalowners = $owners
    else
    $totalowners = ArrayMerge($totalowners, $owners)
    endif
    For $i = 0 To UBound($owners, 1) - 1
    GUICtrlCreateListViewItem($owners[$i][0] & ", " & $owners[$i][1] & ", " & $owners[$i][2]&"|"&$topconcernsnrs[$a][1]&"|"&$owners[$i][6]&"|"&$owners[$i][3] & "-" & $owners[$i][4] & "-" & $owners[$i][5], $listview)
    ;GUICtrlsetdata($naam1,$owners[$i][0] & ", " & $owners[$i][1] & ", " & $owners[$i][2] & " " & $owners[$i][3] & "-" & $owners[$i][4] & "-" & $owners[$i][5]&" ("&$topconcernsnrs[$a][1]&")")
    next
    
    endif
    next
    GUISetState(@SW_SHOW, $Form1)
    return $totalowners
endfunc

func graydonall($owners, $kvknr)
    GUICTRLsetstate($tab1, $GUI_SHOW)
    winsetstate($handle,"", @SW_HIDE)

    for $i=0 to Ubound($owners,1)-1
        $uitslag = graydon($kvknr, $owners[$i][0], $owners[$i][3]&$owners[$i][4]&$owners[$i][5])
        
        if $uitslag = 0 then return "Reject"
        if $owners[$i][1] <> "" then 
            
            $uitslag = graydon($kvknr, $owners[$i][1], $owners[$i][5]&$owners[$i][4]&$owners[$i][5])
            if $uitslag = 0 then return "Reject"
        endif
    Next
    
return "Accept"

endfunc 

func graydon($kvknr, $achternaam, $gebdat)
    
    _IEnavigate($oIE2, "https://mijn.graydon.nl/wps/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3iTEB_34BAzYwN3n1AnAyMfE79gI2cfAwNjY6B8pFm8n79RqJuJp6GhhZmroYGRmYeJk0-Yp4G7izEB3X4e-bmp-gW5EeUABb6wHQ!!/dl2/d1/L2dJQSEvUUt3QS9ZQnB3LzZfNFRMR1NUNjMwR0xVQjAyTDROUzJDTDAwTjQ!/?menulink=1")
    if $oIE2.Document.URL <> "https://mijn.graydon.nl/wps/myportal" Then
        $form1 = _IEFormGetcollection($oIE2, 0)
        $username = _IEformelementgetobjbyname($form1, "wps.portlets.userid")
        $pw = _IEformelementgetobjbyname($form1, "password")
        _IEFormElementSetValue($username, "20963292")
        _IEFormElementSetValue($pw, "pompoen")
        _IEformsubmit($form1)
    endif
    

    $form = _IEFormGetcollection($oIE2, 0)
    $naaminput = _IEformelementgetobjbyname($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:naamInput")
    $gebdatinput = _IEformelementgetobjbyname($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:geboortedatumInput")
    _IEFormElementSetValue($naaminput, $achternaam)
    _IEFormElementSetValue($gebdatinput, $gebdat)
    $goeieknop = _IEFormElementGetObjByName($form, "viewPC_7_4TLGST6300OBC02L224AC100G4_:zoekFormulierForm:lnkStartZoeken")
    _IEAction ($goeieknop, "click")
    _IELoadWait ($oIE2)
    $grayreturn = _IEBodyReadHTML ($oIE2)
$uitslag = StringRegExp ($grayreturn, "zijn er in het NFR geen bedrijven of personen gevonden die aan uw zoekopdracht voldoen of uw zoekopdracht was niet specifiek genoeg",0)
if $uitslag = 0 Then
    _ielinkclickbyindex($oIE2, 17)
    _ieloadwait($oIE2)
    _ielinkclickbytext($oIE2, "Met betrokken bestuurders")
Endif
;$uitslag = 0 betekent slecht nieuws, 1 = goed nieuws. 
writefile($aanvraagnr, $achternaam, "Graydon", $oIE2)

    GUISetState(@SW_SHOW, $Form1)
Return $uitslag
endfunc

func GDM($kvknr, $gdmarray)
    winsetstate($handle,"",@SW_HIDE)
    GUICtrlsetstate($tab2, $GUI_SHOW)
    _IEnavigate($oIE3, "https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
    
    if $oIE3.Document.URL <> "https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S" then
        $form2 = _IEFormGetcollection($oIE3, 0)
        $username = _IEformelementgetobjbyname($form2, "userId")
        $pw = _IEformelementgetobjbyname($form2, "userPassword")
        $submit = _IEformelementgetobjbyname($form2, "submit1")
        _IEFormElementSetValue($username, "santmikeb")
        _IEFormElementSetValue($pw, "sant02")
        _IEaction($submit, "Click")
        _IEloadwait($oIE3)
    ;$form3 = _IEFormGetcollection($oIE3, 0)
    ;$signuplater = _IEFormElementGetCollection($form3,5)
    ;_IEaction($signuplater, "Click")
    ;_IEloadwait($oIE3)
    _ienavigate($oIE3,"https://www.dnbdecisionmaker.com/dm/findCompany.jsp?flow=S")
    endif

    _IEloadwait($oIE3)
    _ielinkclickbytext($oIE3, "KVK Number")
    _IEloadwait($oIE3)
    $form3 = _IEFormGetcollection($oIE3, 0)
    $kvkform = _IEformelementgetobjbyname($form3, "Busno")
    _IEFormElementSetValue($kvkform, $kvknr)
    $signuplater = _IEFormElementGetCollection($form3,3)
    _IEaction($signuplater, "Click")
    _IEloadwait($oIE3)
    _ielinkclickbytext($oIE3, "GDM Plus")
    $form3 = _IEFormGetcollection($oIE3, 0)
    $inputaanvr = _IEformelementgetcollection($form3, 10)
    $inputchan = _IEformelementgetcollection($form3, 11)
    $inputdeal = _IEformelementgetcollection($form3, 12)
    $inputaansch = _IEformelementgetcollection($form3, 14)
    $inputkred = _IEformelementgetcollection($form3, 15)
    $inputrestw = _IEformelementgetcollection($form3, 16)
    $inputloop = _IEformelementgetcollection($form3, 17)
    $inputleef = _IEformelementgetcollection($form3, 18)
    $inputbkr = _IEformelementgetcollection($form3, 19)
    $inputNFR = _IEformelementgetcollection($form3, 21)
    _IEFormElementSetValue($inputaanvr, $gdmarray[0])
    _IEFormElementSetValue($inputchan, "D")
    _IEFormElementSetValue($inputdeal, $gdmarray[1])
    _IEFormElementSetValue($inputaansch, $gdmarray[2])
    _IEFormElementSetValue($inputkred, $gdmarray[3])
    _IEFormElementSetValue($inputrestw, $gdmarray[4])
    _IEFormElementSetValue($inputloop, $gdmarray[5])
    _IEFormElementSetValue($inputleef, $gdmarray[6])
    _IEFormElementSetValue($inputbkr, $gdmarray[7])
    _IEFormElementSetValue($inputNFR, $gdmarray[9])
    $beslis = _IEformelementgetobjbyname($form3, "Submit")
    _IEaction($beslis, "Click")
    _ieloadwait($oIE3)
     $whatitdo = _IEBodyReadHTML($oIE3)
    $accept = StringRegExp ($whatitdo, "Accept.gif")
    $pending = StringRegExp ($whatitdo, "Pending.gif")
    $reject = StringRegExp ($whatitdo, "Reject.gif")

    If $accept = "1" then 
GUICtrlSetState ($gdmaccept, $GUI_SHOW)
    Elseif $pending = "1" Then
GUICtrlSetState ($gdmpending, $GUI_SHOW)
    Elseif $reject = "1" then 
GUICtrlSetState ($gdmreject, $GUI_SHOW)
    EndIf
    writecompanyfile($aanvraagnr,"GDM", $oIE3)

endfunc


Func ConsoleLog($data)
    ConsoleWrite($data & @CR)
EndFunc

; function to get business form
Func GetBusinessForm($content)
    $form = StringRegExp($content, "Rechtsvorm\s+:(.+)\r", 1)
    If UBound($form) == 0 Then
        Return ""
    Else
        Return $form[0]
    EndIf
EndFunc

; function to get names array {last name, maiden name, first name, last name, maiden name, first name, ......}
Func GetNamesArray($content)
    Return StringRegExp($content, "Naam\s+:([^\-\r]+)\-?(.+)?,\s+(.+)\r", 3)
EndFunc

; function to strip prefix in last name
Func StripPrefix($name)
    Return StringStripWS(StringRegExpReplace($name, "(van|de(r|n)?|aan|bij|het|'t|in|onder|op|over|des|'s|te(r|n)?|tot|uit|ver|voor)\s", ""), 1)
EndFunc

; function to get birth date array { day, month, year, day , month, year, ......}
Func GetBirthDateArray($content)
    Return StringRegExp($content, 'Geboortedatum\sen\s\-plaats\s+:(\d{2})\-(\d{2})\-(\d{4})', 3)
EndFunc

Func GetAdressnrArray($content)
    Return StringRegExp($content, 'Adres\s+:\D+\s(\d+),', 3)
EndFunc

Func GetZipcodeArray($content)
    Return StringRegExp($content, 'Adres\s+:\D+\s\d+, (\d+\D\D)', 3)
EndFunc

; function to check if person exists in owner array already
Func CheckIfExist($array, $lastName, $maidenName, $firstName, $day, $month, $year)
    For $i = 0 To UBound($array, 1) - 1
        If $array[$i][0] == $lastName And $array[$i][1] == $maidenName And $array[$i][2] == $firstName And $array[$i][3] == $day And $array[$i][4] == $month And $array[$i][5] == $year Then
            Return True
        EndIf
    Next
    Return False
EndFunc

; function to get owners array {{last name, maiden name, first name, day, month, year}, {last name, maiden name, first name, day, month, year}, ......}
Func GetOwnerArray($content)
    $busform = GetBusinessForm($content)
    $names = GetNamesArray($content)
    $birthDates = GetBirthDateArray($content)
    $adressnrs = ""
    $zipcodes = ""
    $adressnr = ""
    $zipcode = ""
    if NOT $busform = "Besloten Vennootschap" OR "Naamloze Vennootschap" then
    $adressnrs = GetAdressnrArray($content)
    $zipcodes = GetZipcodeArray($content)
    endif
    ; declare temp array
    Local $temp[UBound($names) / 3][9]
    
    $count = 0
    
    For $i = 0 To UBound($names) / 3 - 1
        ; strip out prefix from both last name and maiden name (if exists)
        $lastName   = StripPrefix($names[$i * 3])
        $maidenName = StripPrefix($names[$i * 3 + 1])
        $firstName  = $names[$i * 3 + 2]
        
        $day    = $birthDates[$i * 3]
        $month  = $birthDates[$i * 3 + 1]
        $year   = $birthDates[$i * 3 + 2]
        if NOT $busform = "Besloten Vennootschap" OR $busform = "Naamloze Vennootschap" then
        $adressnr = $adressnrs[$i+1]
        $zipcode = $zipcodes[$i+1]
        endif
        
        
        ; if not exist, add to temp array and increase counter
        If Not CheckIfExist($temp, $lastName, $maidenName, $firstName, $day, $month, $year) Then
            $temp[$count][0] = $lastName
            $temp[$count][1] = $maidenName
            $temp[$count][2] = $firstName
            $temp[$count][3] = $day
            $temp[$count][4] = $month
            $temp[$count][5] = $year
            $temp[$count][6] = $busform
            $temp[$count][7] = $adressnr
            $temp[$count][8] = $zipcode
            $count += 1
        EndIf
    Next
    
    ; store owners in new array with correct size and return
    Local $owners[$count][9]
    For $i = 0 To $count - 1
        $owners[$i][0] = $temp[$i][0]
        $owners[$i][1] = $temp[$i][1]
        $owners[$i][2] = $temp[$i][2]
        $owners[$i][3] = $temp[$i][3]
        $owners[$i][4] = $temp[$i][4]
        $owners[$i][5] = $temp[$i][5]
        $owners[$i][6] = $temp[$i][6]
        $owners[$i][7] = $temp[$i][7]
        $owners[$i][8] = $temp[$i][8]
    Next
    Return $owners
EndFunc 
    
func _IECreate2($xWidth, $xHeight, $hGUI)
$pid = Run(@ProgramFilesDir&"\internet explorer\iexplore.exe -k "&"www.kvk.nl", "", @SW_HIDE)

Sleep(3000)
$hHandle = _ProcessGetHWnd($pid)
GUISetState(@SW_SHOW, $hGUI)


_WinAPI_SetParent($hHandle, $hGUI)
_WinAPI_MoveWindow($hHandle, 520, 30, 500, 650, True)
_WinAPI_SetWindowLong($hHandle, $GWL_STYLE, $WS_POPUP+$WS_VISIBLE)


$oIE = _IEAttach("http://www.kvk.nl/", "URL")


if @error = 7 then
    while @error = 7
        $oIE = _IEAttach("http://www.kvk.nl/", "URL")
    wend
endif

Send("{F5}")

return $hHandle
EndFunc


Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000)
    Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit()
    While 1
      $aWin = WinList($sTitle)
        For $i = 1 To $aWin[0][0]
            If $iPid = WinGetProcess($aWin[$i][1]) Then
                If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then
                    Return $aWin[$i][1]
                ElseIf $iOption = 2 Then
                    ReDim $aReturn[UBound($aReturn) + 1][2]
                    $aReturn[0][0] += 1
                    $aReturn[$aReturn[0][0]][0] = $aWin[$i][0]
                    $aReturn[$aReturn[0][0]][1] = $aWin[$i][1]
                EndIf
            EndIf
        Next
        If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn
        If TimerDiff($hTimer) > $iTimeout Then ExitLoop
        Sleep(Opt("WinWaitDelay"))
    WEnd
       SetError(1)
    Return 0
EndFunc  ;==>_ProcessGetHWnd

func kvknrget($bodytext)
    $nieuwkvknr = stringregexp($bodytext,"KvK-nummer:........",1)
    $nieuwkvknr = stringreplace($nieuwkvknr[0], "KvK-nummer:", "")
    return $nieuwkvknr
endfunc

func getkvklinks($IE)
$teller = 0
$teller2 = 0

$links = $IE.document.links
                For $link In $links
                if $teller > 3 Then
                if $link.outerText <> "Opnieuw zoeken" then 
                    if $link.outerText&"" <> "Totale concern" then
                    $teller2 = $teller2+1
                    endif
                Else
                Exitloop
                endif
                
                endif
                $teller=$teller+1
            Next

local $hrefs[$teller2][2]
$teller3 = 0
$teller4 = 0
$links = $IE.document.links
                For $link In $links
                if $teller3 > 3 Then
                if $link.outerText&"" <> "Opnieuw zoeken"  then
                        if $link.outerText&"" <> "Totale concern" then
                    $kvktemp = Stringreplace($link.href, "https://server.db.kvk.nl/TST-BIN/FU/TSWS001@?BUTT=", "")
                    $hrefs[$teller4][0]=$kvktemp
                    $hrefs[$teller4][1]=$link.outerText
                    $teller4 = $teller4+1
                    endif
                Else
                Exitloop
                endif
                endif
                $teller3 = $teller3+1
            Next        
return $hrefs
endfunc

Func ArrayMerge($amArray1, $amArray2)
    Local $tempArray = $amArray1
    Local $amElements = Ubound($tempArray,1) + Ubound($amArray2,1)
    Redim $tempArray[$amElements][9]
    Local $amCount = 0
    
    For $X = Ubound($amArray1) to $amElements - 1
        $tempArray[$X][0] = $amArray2[$amCount][0]
        $tempArray[$X][1] = $amArray2[$amCount][1]
        $tempArray[$X][2] = $amArray2[$amCount][2]
        $tempArray[$X][3] = $amArray2[$amCount][3]
        $tempArray[$X][4] = $amArray2[$amCount][4]
        $tempArray[$X][5] = $amArray2[$amCount][5]
        $tempArray[$X][6] = $amArray2[$amCount][6]
        $tempArray[$X][7] = $amArray2[$amCount][7]
        $tempArray[$X][8] = $amArray2[$amCount][8]
        $amCount += 1
    Next
    Return $tempArray
EndFunc

func toetsing($owners,$aanvraagnr)

$handlelogi = ""
if processexists("bkr.exe") = 0 then
    run("\\scsrvbkr.santander.local\BKRCLIENT\bkr.exe")
    
    winwait("Inloggen")
    winsetstate("Inloggen","", @SW_hide)
    $handlelogi = wingethandle("LogiLink BKR")
endif

;   winactivate($handlelogi)
;if winactive("Inloggen") then
    ;controlsend("Inloggen","","TMaskEdit2","bkr")
    ;controlsettext("Inloggen","","Edit2","1105000")
    ;controlclick("Inloggen","","TBitBtn2")
;endif

controlclick("LogiLink BKR","","TPanel4","primary", 1, 15, 13)

winactivate("LogiLink BKR")
$BKRCODE = 0
$Form3 = GUICreate("Logilink controle paneel", 340, 490, 208, 190)
$Toetsvorm = GUICtrlCreateGroup("BKR toetsen", 8, 0, 329, 265)
$Button4 = GUICtrlCreateButton("Naam/gebdatum", 16, 224, 105, 25)
$Label4 = GUICtrlCreateLabel("Bovenstaande persoon toetsen op.....", 24, 200, 182, 17)
$Label5 = GUICtrlCreateLabel("Selecteer de persoon die u wilt toetsen", 24, 16, 187, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button5 = GUICtrlCreateButton("Postcode/huisnr", 128, 224, 105, 25)
$Button6 = GUICtrlCreateButton("Beide", 248, 224, 81, 25)
$Button7 = GUICtrlCreateButton("Sla huidige BKR output op", 8, 280, 219, 25)
$Eindoordeel = GUICtrlCreateGroup("Eindoordeel", 8, 312, 305, 180)
$Label1 = GUICtrlCreateLabel("Geef hier je eindoordeel over alle BKR output.", 24, 336, 220, 17)
$Label2 = GUICtrlCreateLabel("Deze score kan verschillen van 1 (goed) tot 4 (slecht)", 24, 352, 256, 17)
$Label3 = GUICtrlCreateLabel("Deze informatie wordt gebruikt in GDM.", 24, 368, 189, 17)
$Combo1 = GUICtrlCreateCombo("1", 24, 392, 105, 25)
guictrlsetdata($combo1, 2)
guictrlsetdata($combo1, 3)
guictrlsetdata($combo1, 4)
$Label3 = GUICtrlCreateLabel("Was er sprake van een EVA pop-up?", 24, 428)
$Combo2 = GUICtrlCreateCombo("Nee", 24, 450, 105, 25)
guictrlsetdata($combo2, "Ja")
$Button8 = GUICtrlCreateButton("Logilink afgerond", 152, 452, 129, 25) 
GUICtrlCreateGroup("", -99, -99, 1, 1)
$List1 = GUICtrlCreateListview("Naam         |Bedrijfsvorm|Geboortedatum|Huisnr|Postcode", 24, 32, 273, 162)
for $d=0 to ubound($owners, 1)-1
GUICtrlCreateListViewItem($owners[$d][0]&" "&$owners[$d][1]&", "&$owners[$d][2]&"|"&$owners[$d][6]&"|"&$owners[$d][3] & "-" & $owners[$d][4] & "-" & $owners[$d][5]&"|"&$owners[$d][7]&"|"&$owners[$d][8], $list1)
next
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###
winactivate($handlelogi)
While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                Case $GUI_EVENT_CLOSE
                    GUIdelete($form3)
                    Exitloop
                Case $button4
                        winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )

                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit11",$goeieitems[1])
                    controlsettext("Persoon toetsing","","TMaskEdit9",$item[3])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                    
                Case $button5
                    winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit7",$item[4])
                    controlsettext("Persoon toetsing","","TMaskEdit8",$item[5])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck","")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                    
                Case $button6
                    winactivate("Persoon toetsing")
                    
                    winwaitactive("Persoon toetsing")
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )
                    winactivate("Persoon toetsing")
                    
                    controlsettext("Persoon toetsing","","TMaskEdit11",$goeieitems[1])
                    controlsettext("Persoon toetsing","","TMaskEdit9",$item[3])
                    controlsettext("Persoon toetsing","","TMaskEdit7",$item[4])
                    controlsettext("Persoon toetsing","","TMaskEdit8",$item[5])
                    if $item[2] = "Besloten Vennootschap" OR $item[2] = "Naamloze Vennootschap" then
                    controlcommand("Persoon toetsing","","TCheckBox13", "UnCheck")
                    endif
                    controlclick("Persoon toetsing","","TBitBtn7")
                
            Case $button7
                winactivate ("LogiLink BKR")
                $handle = wingethandle("LogiLink BKR")
                $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                $goeieitems = StringSplit ( $item[1], "," )
                $naam = $goeieitems[1]
                bkropslaan($handle, $aanvraagnr, $naam)
            
            Case $button8
                    $EVAhit = guictrlread ($combo2)
                    $index = _GUICtrlListView_GetSelectedIndices  ($list1)
                    $item = _GUICtrlListView_GetItemTextarray   ($list1,$index+0)
                    $goeieitems = StringSplit ( $item[1], "," )
                    $naam = $goeieitems[1]
                    If $EVAhit = "Ja" then 
                        evahit ($naam,$aanvraagnr)
                    Endif
                    $BKRCODE = guictrlread($Combo1)
                    
                    guidelete($form3)
                    winactivate("Mercury")
                    Exitloop
                EndSwitch
                
            WEnd
            ProcessClose ( "bkr.exe")

    return $BKRCode

endfunc
Func bkropslaan ($handle, $aanvraagnr, $naam)
    $posarray = ControlGetpos ($handle, "", "TListBox1")
    winactivate($handle)
    winwaitactive($handle)
    DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$naam)
    _ScreenCapture_CaptureWnd("N:\Auto IT\Development\"&$aanvraagnr&"\"&$naam&"\BKR"&$naam&".jpg", $handle, $posarray[0]+5, $posarray[1]+45, $posarray[0]+$posarray[2], $posarray[1]+$posarray[3], false)
    Winactivate ("Logilink controle paneel")
RETURN
EndFunc

func bkrreadycheck($handle)
    
    while hex(pixelgetcolor(691, 545, $handle)) <> "00008000"
        sleep(10)
    wend
    while hex(pixelgetcolor(691, 545, $handle)) <> "00D4D0C8"
        sleep(100)
    wend
RETURN
endfunc
func evahit ($klantnaam, $aanvraagnr)
DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam)
FileCopy ( @scriptdir&"\evahit.bmp", "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\")
EndFunc

func writefile($aanvraagnr, $klantnaam, $site, $IE)

DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam)
FileOpen ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\"&$site&$klantnaam&".htm",8)
$tekst = _IEBodyReadHTML($IE)
$gelukt = filewrite("N:\Auto IT\Development\"&$aanvraagnr&"\"&$klantnaam&"\"&$site&$klantnaam&".htm",$tekst)
If $gelukt <> "1" Then
    Msgbox (0, "Let op!", "Het opslaan van de output van "&$site&" is niet gelukt. Zorg dat je deze informatie alsnog opslaat.")
Endif
endfunc

func writecompanyfile($aanvraagnr,$site, $IE)

DirCreate ( "N:\Auto IT\Development\"&$aanvraagnr&"\")
FileOpen ( "N:\Auto IT\Development\"&$aanvraagnr&"\"&$site&".htm",8)
$gelukt = filewrite("N:\Auto IT\Development\"&$aanvraagnr&"\"&$site&".htm",_IEBodyReadHTML($IE))
If $gelukt <> "1" Then
    Msgbox (0, "Let op!", "Het opslaan van de output van "&$site&" is niet gelukt. Zorg dat je deze informatie alsnog opslaat.")
Endif
endfunc

func kvkhistorie ($kvknr,$aanvraagnr)
    $kvkarray = stringsplit ($kvknr, "")
    _IEnavigate($oIE, "https://server.db.kvk.nl/TST-BIN/RB/RBHRH01@?BUTT=H|"&$kvkarray[1]&$kvkarray[2]&"|"&$kvkarray[3]&$kvkarray[4]&$kvkarray[5]&$kvkarray[6]&$kvkarray[7]&$kvkarray[8]&"|||0|0")
    $kvkhistoriereturn = _IEBodyReadHTML ($oIE)
     $historieaanwezig = StringRegExp($kvkhistoriereturn, "Geen handelsregisterhistorie")
     Local $returnarray [2]
     If $historieaanwezig = "1" then 
    $returnarray [0] = "geen"
     Else 
        $returnarray [0] = "wel"
    Endif
    $returnarray[1] = $kvkhistoriereturn
    writecompanyfile ($aanvraagnr, "KVK historie", $oIE)
    Return $returnarray
Endfunc

Func allesnaaracces ($offertenr, $aanvraagnr,$datumaanvraag ,$dealernaam,$verkoper,$telefoon,$aanvrager,$kvknr,$kontaktpersoon,$telefoon2, $automerk,$autotype, $looptijd,$oudofnieuw,$contractsoort, $verkoopprijs, $inzetbedrag, $leasetarief, $rob, $hsb, $verzekering, $vervoer,$brandstof,$bijafbin = "",$dealernr = "",$aktie = "",$aanbetaling="",$bpmtekst ="",$kmstand = "", $overname = "", $bijklant = "",$slottermijn = "",$debiteurnr = "",$tussenpersoon="" , $opmerking = "",$mobiel = "",$accountant= "",$kontaktpersoon2 = "",$telefoon3 = "")
If ProcessExists ("Kredietaanvraag.exe")Then
    sleep (1)
    Else
    Run ("\\scsrvfps01\datastore_scnl\Kredietaanvraag\Kredietaanvraag.exe")
Endif
WinActivate ("Aanvraaggegevens")
Winwaitactive ("Aanvraaggegevens")
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:29]", $offertenr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:30]", $aanvraagnr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:31]", $debiteurnr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:32]", $datumaanvraag)

ControlCommand ( "Aanvraaggegevens", "", 56, "SelectString", $bijklant) 
ControlCommand ( "Aanvraaggegevens", "", 46, "SelectString",$bijafbin)

ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:28]", $dealernr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:27]", $dealernaam)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:26]", $verkoper)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:25]", $telefoon)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:24]", $aanvrager)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:23]", $kvknr)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:22]", $kontaktpersoon)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:21]", $telefoon2)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:20]", $mobiel)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:19]", $accountant)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:18]", $kontaktpersoon2)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:17]", $telefoon3)

ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:15]", $automerk)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:14]", $autotype)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:13]", $looptijd)
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:12]", $km)
    If $oudofnieuw = "Gebruikt" then 
    ControlCommand ( "Aanvraaggegevens", "", 26, "SelectString", $oudofnieuw)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:11]", $datumdeel1)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:10]", $kmstand)
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:9]", $kenteken)
    Else 
    ControlCommand ( "Aanvraaggegevens", "", 26, "SelectString", $oudofnieuw)
    Endif
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6ComboBox; INSTANCE:3]", $aktie)
ControlCommand ( "Aanvraaggegevens", "", 23, "SelectString",$contractsoort)

    ;If $BPM = "1" then 
    ;ControlCommand ( "Aanvraaggegevens", "BPM", 14, "check")
    ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:1]", $bpmtext)
    ;Endif
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:8]", $verkoopprijs)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:7]", $aanbetaling)
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:12]", $km)
    If $contractsoort = "FL" Then
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:6]", $aanbetaling)
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:5]", $overname)
        ;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:3]", $slottermijn)
    EndIf
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:4]", $inzetbedrag)
ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6TextBox; INSTANCE:2]", $leasetarief)

    If $ROB = "1" then 
    ControlCommand ( "Aanvraaggegevens", "ROB", 11, "check")
    Endif
    If $HSB = "1" then 
    ControlCommand ( "Aanvraaggegevens", "HSB", 10, "check")
    Endif
    If $verzekering = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Verzekering", 9, "check")
    Endif
    If $brandstof = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Brandstof", 8, "check")
    Endif
    If $vervoer = "1" then 
    ControlCommand ( "Aanvraaggegevens", "Verv. vervoer", 7, "check")
    Endif
;ControlSetText("Aanvraaggegevens", "", "[CLASS:ThunderRT6ComboBox; INSTANCE:1]", $tussenpersoon).
If $opmerking <> "" Then

ControlClick("Aanvraaggegevens", "", 2)
ControlSetText("Opmerking toevoegen", "", "[CLASS:ThunderRT6TextBox; INSTANCE:1]", $opmerking)
ControlClick("Opmerking toevoegen", "", "ThunderRT6CommandButton1")
Endif
;ControlClick("Aanvraaggegevens", "", "ThunderRT6CommandButton3")
Return

EndFunc

Func wisplaatjes ()
    GUICtrlSetState ( $kvkconcerngoed, $GUI_HIDE)
    GUICtrlSetState ($kvkuitrekselgoed , $GUI_HIDE)
GUICtrlSetState ( $kvkhistoriegoed, $GUI_HIDE)
GUICtrlSetState ( $accesgoed, $GUI_HIDE)
GUICtrlSetState ( $kvkgdmgoed, $GUI_HIDE)
GUICtrlSetState ( $dealergoed, $GUI_HIDE)
GUICtrlSetState ( $kvkhistorieslecht, $GUI_HIDE)
GUICtrlSetState ( $kvkuitrekselslecht, $GUI_HIDE)
GUICtrlSetState ($graydonslecht, $GUI_HIDE)

GUICtrlSetState ( $gdmslecht, $GUI_HIDE)
GUICtrlSetState ($dealerslecht, $GUI_HIDE)
GUICtrlSetState ($geenconcern, $GUI_HIDE)
GUICtrlSetState ($bkrgeencodes, $GUI_HIDE)
GUICtrlSetState ($bkrwelcodes, $GUI_HIDE)
GUICtrlSetState ($evageen, $GUI_HIDE)
GUICtrlSetState ($evawel, $GUI_HIDE)
GUICtrlSetState ($graydongeen, $GUI_HIDE)
GUICtrlSetState ($graydonwel, $GUI_HIDE)
GUICtrlSetState ($gdmaccept, $GUI_HIDE)
GUICtrlSetState ($gdmpending, $GUI_HIDE)
GUICtrlSetState ($gdmreject, $GUI_HIDE)
Endfunc

Func wisinvoer ()
    Guictrlsetdata ($aanvraagnr, "")
    Guictrlsetdata ($debitnr, "")
    Guictrlsetdata ($offertenr, "")
    Guictrlsetdata ($dealernaam, "")
    Guictrlsetdata ($verkoper, "")
    Guictrlsetdata ($bijafbin, "Uitbreiding")
    Guictrlsetdata ($bijklant, "Uitbreiding")
    Guictrlsetdata ($dealernr, "")
    Guictrlsetdata ($dealertel, "")
    Guictrlsetdata ($aanvrager, "")
    Guictrlsetdata ($kvknummer, "")
    Guictrlsetdata ($telefoon, "")  
    Guictrlsetdata ($contactpers, "")
    Guictrlsetdata ($mobiel, "")    
    Guictrlsetdata ($accountant, "")    
    Guictrlsetdata ($accounttel, "")
    Guictrlsetdata ($automerk, "")
    Guictrlsetdata ($looptijd, "")
    Guictrlsetdata ($newauto, "Nieuw")
    Guictrlsetdata ($autotype, "")
    GUICtrlSetData ($datdeel1, " ")
    Guictrlsetdata ($actie, " ")
    Guictrlsetdata ($kmstand, "")
    Guictrlsetdata ($kenteken, "")
    Guictrlsetdata ($contracttype, " ")
    Guictrlsetdata ($verkoopprijs, "")
    Guictrlsetdata ($aanbet, "")
    Guictrlsetdata ($inruil, "")
    Guictrlsetdata ($overnamebijfl, "")
    Guictrlsetdata ($inzet, "")
    Guictrlsetdata ($slotterm, "")
    Guictrlsetdata ($leasetarief, "")
    Guictrlsetdata ($rob, "Nee")
    Guictrlsetdata ($hsb, "Nee")
    Guictrlsetdata ($verzekering, "Nee")
    Guictrlsetdata ($brandstof, "Nee")
    Guictrlsetdata ($vervoer, "Nee")
    Guictrlsetdata ($opmerking, "")
EndFunc
Edited by Rigest

Share this post


Link to post
Share on other sites
AdmiralAlkex

You have a lot of lines like this:

$offertenr = GUICtrlRead($offertenr)

Look at what you're doing with the variable. You overwrite the controlid with the text from the control, so the next time you try to use offertenr it contains some old text instead of the controlid you need.

Do you understand?

Share this post


Link to post
Share on other sites
Rigest

You have a lot of lines like this:

$offertenr = GUICtrlRead($offertenr)

Look at what you're doing with the variable. You overwrite the controlid with the text from the control, so the next time you try to use offertenr it contains some old text instead of the controlid you need.

Do you understand?

Yes I do, finally! Thank you very much Admiral, /salute.

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.