Jump to content

Recommended Posts

Posted

Hello,

I want to change a label with an If operaton. But it won't work. I've created a checkbox so I am shure the compared value is right. But the label does not update. I'm shure the cause is easy but I don't know where the fault is.

Some Code:

Case $btnHoch
            $ID = GUICtrlRead ($inpID)
            $DateiHoch = $ID & ".xml"
            ;$hochDatei = FileOpen($hochPfad & $DateiHoch)
            $hochDatei = FileOpen("(deleted the path due privacy)" & $DateiHoch)
            $line = FileReadLine($hochDatei,6)
            If $line = "<TotalResult>1</TotalResult>" Then GUICtrlSetData ($lblHoch,"Ja")
            MsgBox ($MB_OK,"hhh", $line)

I hope you can help

Cheers

  • Developers
Posted (edited)

Just post a script that replicates your issue we can run to test with, as this looks ok so far.

one other thing you could do is change the msgbox to:

ConsoleWrite ("|" & $line & "|" & @crlf)

Run it with SciTE and show us the exact console output.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Hi,

I cut some peaces out. There was another button event. But it has nothing to do with my problem. Hope the code is enough. all what is cencored is a file path.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_Outfile=Prüfdings.exe
#AutoIt3Wrapper_Compile_Both=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Excel.au3>
#include <Date.au3>
#include <WinAPIFiles.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Marcinator_2\Documents\Wiesheu\Auswertung\autoit\Prüfdings.kxf
$Form1 = GUICreate("Prüfdings", 615, 437, -1, -1)
Global $tCur = _Date_Time_GetLocalTime()
Global $lblPA = GUICtrlCreateLabel("PA:", 56, 40, 21, 17)
Global $lblID = GUICtrlCreateLabel("ID:", 56, 64, 18, 17)
Global $lblPruefer = GUICtrlCreateLabel("Prüfer:", 56, 16, 35, 17)
Global $Date1 = GUICtrlCreateDate($tCur, 392, 24, 186, 21)
Global $inpPA = GUICtrlCreateInput("", 120, 40, 121, 21)
Global $inpID = GUICtrlCreateInput("", 120, 64, 121, 21)
Global $combPruefer = GUICtrlCreateCombo("", 120, 16, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
Global $editKommentar = GUICtrlCreateEdit("", 392, 128, 169, 145)
Global $lblKommentar = GUICtrlCreateLabel("Kommentar:", 392, 104, 60, 17)
Global $lblBedienteil = GUICtrlCreateLabel("Bedienteil-ID:", 56, 112, 67, 17)
Global $inpBedienteil = GUICtrlCreateInput("", 160, 112, 121, 21)
Global $lblLeistung = GUICtrlCreateLabel("Leistungseinheit-ID:", 56, 136, 97, 17)
Global $inpLeistung = GUICtrlCreateInput("", 160, 136, 121, 21)
Global $lblOption = GUICtrlCreateLabel("Optionsplatine-ID:", 56, 168, 88, 17)
Global $inpOption = GUICtrlCreateInput("", 160, 160, 121, 21)
Global $lblLinie = GUICtrlCreateLabel("Linie:", 56, 200, 29, 17)
Global $combLinie = GUICtrlCreateCombo("", 160, 192, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
Global $checkCheck = GUICtrlCreateCheckbox("Checkliste abgearbeitet", 392, 72, 153, 17)
GUICtrlSetState($checkCheck, $GUI_CHECKED)
Global $butSchreiben = GUICtrlCreateButton("Schreiben", 160, 272, 73, 41)
Global $btnHoch = GUICtrlCreateButton("Hochspannung bestanden?", 392, 288, 153, 33)
Global $lblHoch = GUICtrlCreateLabel("Nein", 552, 288, 55, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $hochPfad = _WinAPI_GetTempFileName("censored")



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    

    Case $btnHoch
            $ID = GUICtrlRead ($inpID)
            $DateiHoch = $ID & ".xml"
            ;$hochDatei = FileOpen($hochPfad & $DateiHoch)
            $hochDatei = FileOpen("censored" & $DateiHoch)
            $line = FileReadLine($hochDatei,6)
            If $line = "<TotalResult>1</TotalResult>" Then GUICtrlSetData ($lblHoch,"Ja")
            MsgBox ($MB_OK,"hhh", $line)

    EndSwitch
WEnd

 

Posted

I've changed The MsgBox as you said. Thats the output:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\Prüfdings forum.au3" /UserParams    
+>18:13:49 Starting AutoIt3Wrapper (19.1127.1402.0} from:SciTE.exe (4.2.0.0)  Keyboard:00000407  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0407)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Marcinator_2\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Marcinator_2\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:D:\Prüfdings forum.au3
+>18:13:50 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Prüfdings forum.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
|    <TotalResult>1</TotalResult>|

 

  • Developers
Posted (edited)
4 minutes ago, Marcinator_2 said:

OMG.. I think I've found the error! There are spaces in front of my search string! One min.

Hence my suggestion for the consolewrite with the "||" so you can see them. ;) 
It happens often that Space/Tab or CR, LF character is part of the string making the test fail.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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