;~ #includes #include ;reference that Excel UDF is included #include ;Grafical User Interface #include ;including window cosntants of the au3 script #include #include #include ;~ $variables ;~ Read Only File Local $sReadFile = @ScriptDir & "\5_Zeiterfassung mit GUI input.xlsx" ;~ Save File Name Local $sSaveFile = @ScriptDir & "\SaveFile.xlsx" ;~ counting variable $counter1 = 1 $counter2 = 1 $counter3 = 1 ;~GUI desginged in Kodpe #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 350, 50, 192, 124) $Button1 = GUICtrlCreateButton("A", 16, 16, 75, 25) $Button2 = GUICtrlCreateButton("B", 112, 16, 75, 25) $Button3 = GUICtrlCreateButton("C", 200, 16, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ Open Excel --- $oExcel=the variable standing for the open Excel-window $oExcel = _Excel_Open() ;~ Open ReadFile.xlsx as Read Only --- $oWorkBook=the variable standing for the open Excel workbook $oWorkBook = _Excel_BookOpen($oExcel, $sReadFile, False, True) $nMsg = GUIGetMsg() ;opens the GUI Switch $nMsg ;conditional statement Case $button1 or $button2 or $button3="1" ;change of the conditional statement If $button1="1" Then $machine="A" If $button2="1" Then $machine="B" If $button3="1" Then $machine="C" dim $time[8] = [$counter,$machine,@YEAR,@mon,@MDAY,@HOUR,@MIN,@SEC] ; time inforamtion $transposetime=_ArrayTranspose ($time) ;transposed time inforamtion _Excel_RangeWrite($oWorkBook,1,$time,"D10") ;write in B2 $oExcel.Range("D2:L2").Select $oExcel.Selection.Copy $oExcel.Range("D10:L10").Select $oExcel.Selection.Insert(-4121) ;~ increase counter $counter1 = $counter1 + 1 Case $GUI_EVENT_CLOSE ;pressing the close button in the corner Exit ;GUI is being closed EndSwitch