Jump to content

Wingens

Active Members
  • Posts

    132
  • Joined

  • Last visited

About Wingens

  • Birthday 08/22/1987

Profile Information

  • Location
    Netherlands

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Wingens's Achievements

  1. Please I am not here to discus our companies choise. Is there a way to get this to work?
  2. Automating the credentials, when we replace a workstation or a new employee logs in he needs to input the credentials. From autoit i would be able to send the credentials.
  3. Hi, i am trying to create a easy way for our employees to login to servers using RDP. This is the first stage later on the username and passwords will be automaticly entered when choosing the server. I have found this code on the forum and am trying to get in to work however it is not connecting. Perhaps I am missing something here? Source: https://www.autoitscript.com/forum/topic/133217-rdp-session-in-autoit-gui/ Post: ByteSniper #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #RequireAdmin Opt("GUIOnEventMode", 1) $hGUI = GUICreate("RDP", 1401, 801, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "hGUIClose") $Connect = GUICtrlCreateButton("Connect", 1272, 16, 115, 33, 0) GUICtrlSetOnEvent(-1, "ConnectClick") GUICtrlCreateLabel("Username:", 1272, 130) $USER = GUICtrlCreateInput("", 1272, 150, 115, 23) GUICtrlCreateLabel("Password:", 1272, 180) $Password = GUICtrlCreateInput("", 1272, 200, 115, 23, $ES_PASSWORD) ;GUICtrlSetOnEvent(-1, "ConnectClick") $oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx $oRDP_Ctrl = GUICtrlCreateObj($oRDP, 4, 4, 1232, 792) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE) GUICtrlSetStyle($oRDP_Ctrl , $WS_EX_STATICEDGE) $oRDP.DesktopWidth = 1240 $oRDP.DesktopHeight = 800 $oRDP.Fullscreen = False $oRDP.ColorDepth = 16 $oRDP.AdvancedSettings3.SmartSizing = True $serveur = GUICtrlCreateCombo("", 1272, 50, 120, 23) GUICtrlSetData(-1, "", "") GUICtrlSetFont(-1, 9, 800, 0, "Courier new") ;GUICtrlSetOnEvent(-1, "ConnectClick") GUISetState(@SW_SHOW) Call("Load_srv") While 1 Sleep(100) WEnd Func ConnectClick() $GO = 1 $host = GUICtrlRead($serveur,1) ;<<<<<<< enter here the host name or ip address $Name = GUICtrlRead($USER) $Pass = GUICtrlRead($Password) If $host = "" Then MsgBox(4096, "", "Please choose a server.") $GO = 0 EndIf If $Name = "" Then MsgBox(4096, "", "Please fill in a username.") $GO = 0 EndIf If $Pass = "" Then MsgBox(4096, "", "Please fill in a password.") $GO = 0 EndIf If $GO = 1 Then $oRDP.Server = $host $oRDP.UserName = $Name $oRDP.Domain = "" $oRDP.AdvancedSettings2.ClearTextPassword = $Pass $oRDP.ConnectingText = "Connecting to " & $host $oRDP.DisconnectedText = "Disconnected from " & $host $oRDP.StartConnected = True $oRDP.connect() EndIf EndFunc func Load_srv() $var = IniReadSection(@ScriptDir & "\RDP_QC.ini","Serveurs") For $i = 1 To $var[0][0] ; MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) GUICtrlSetData($serveur,$var[$i][1]) Next endFunc Func hGUIClose() exit EndFunc [serveurs] Server1 = 192.168.2.2 Server2 = Server2 Server3 = Server3
  4. I am trying to create a tool for our support guys to fill in the server checks they need to do. Right now the fill in a paper form. I created a GUI wich saves the data in an ini-file every server has a ini-file with the same layout. In the history tab we would like to pick a server from a combo list and at that point read the ini file match the sections with the check-id numbers and view them in a listview. I am struggeling with creating a way to fill in the listview with the inifile data that is match with different sections. The combobox is filled with an inifile with names: [SERVERS] APOLLO2CS0 = *.*.*.* APOLLO2CS1 = *.*.*.* APOLLO2CS2 = *.*.*.* APOLLO2CS3 = *.*.*.* APOLLO2CS4 = *.*.*.* APOLLO2CS5 = *.*.*.* APOLLO2CS6 = *.*.*.* The Inifile per server looks like: [LASTCHECK] Datum=17-02-2020 [NEXTCHECK] Datum=16-03-2020 [CONTROLEID] 1=1 3=3 4=4 [CHECKDATUM] 1=14-02-2020 3=17-02-2020 4=17-02-2020 [SCHIJFRUIMTE] 1=Ja 3=Ja 4=Ja [BACKUP] 1=Nee 3=Ja 4=Ja [CHECKSERVER] 1=Nee 3=Ja 4=Nee [APOLLOCSLOG] 1=Ja 3=Ja 4=Ja [EVENTVIEWER] 1=Nee 3=Ja 4=Nee [WUPDATE] 1=Nee 3=Ja 4=Ja [REBOOT] 3=Nee 4=Ja I added the code i have so far. You will probebly get an error opening the GUI because you are missing files. Hopefully you guys can help me. V0.1.au3
  5. Thx just copied it to a notepad and then recopied it to the editor now it is working.
  6. @LukeLe I did add it, i will add my entire script to this post. All the way below you will find the func i added. 2.0.0.au3
  7. @Nine Thx for the reply only problem is i am getting:
  8. Hi I am trying to create a GUI at wich turns the input field yellow when the cursor/focus is on it. So the users instandly sees where they are typing. Right now I am stuck with this code, it get's the focus but it does not change the input background color. Hope you guys can help me. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <file.au3> #include <array.au3> #include <GuiListView.au3> #include <Misc.au3> #include <ColorConstants.au3> #include <GUIComboBox.au3> Global $VERSION = "2.0.0 | Build: 20819" $INLOGGUI = GUICreate($VERSION & " - Inloggen", 332, 342, -1, -1, $WS_POPUPWINDOW) $BG = GUICtrlCreatePic(@ScriptDir & '\Images\LoginBG.BMP', 0, 0, 332, 342) $TITEL = GUICtrlCreateLabel("Inloggen", 0, 40, 332, 30, $ES_CENTER) GUICtrlSetFont(-1, 18, 800, 0, "Calibri") $LABELUSERNAME = GUICtrlCreateLabel("Gebruiker", 50, 150, 50, 17) $Combo1 = GUICtrlCreateCombo("Kies een medewerker...", 50, 167, 233, 25, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) $LABELPASSW = GUICtrlCreateLabel("Wachtwoord:", 50, 210, 77, 17, 0) $PasswordEdit = GUICtrlCreateInput("", 50, 227, 233, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_PASSWORD)) $VERSIONLABEL = GUICtrlCreateLabel("Versie: " & $VERSION, 8, 323) $hLabel = GUICtrlCreateLabel("", 0, 0, 332, 50, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetState($BG, $GUI_DISABLE) GUICtrlSetBkColor($TITEL, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($LABELUSERNAME, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($LABELPASSW, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($Combo1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($PasswordEdit, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($VERSIONLABEL, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetBkColor($hLabel, $GUI_BKCOLOR_TRANSPARENT) Local $hDLL = DllOpen("user32.dll") GUISetState(@SW_SHOW) While 1 $Test = ControlGetFocus($VERSION & " - Inloggen") IF $Test = "Edit1" Then GUICtrlSetBkColor($Combo1, $COLOR_YELLOW) Else GUICtrlSetBkColor($Combo1, $COLOR_WHITE) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  9. I really want to use a SQL database for this but i don't know how to connect to a database... and create tables and stuff like that.
  10. @FrancescoDiMuro Ok i will try, What i am trying to create is a way to register when people take a day of or get sick or take vacation and how much of the hours the have it would take. I got it working for the people who are working full-time (5 days a week and 8 hours a day) but we have several people who work less then 5 days a week and now when we select a periode of 5+ days we need it to read the hours a week and calculate how many days of vacation they take.
  11. Sorry forgot to put the includes in them. It's part of a larger script, so here are all the includes from the total script: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <file.au3> #include <array.au3> #include <GuiListView.au3> #include <Misc.au3> #include <smtpauth.au3> #include <Inet.au3> #include <DateTimeConstants.au3> #include <Date.au3> #include <GuiListView.au3> #include <ColorConstants.au3>
  12. Hi, I am trying to create a bit of hour registration tool. The problem i am running into is that allmost every body works 40 hours (5 days) a week except for 2 people. The work 24 hours (3 days) a week. I made a registration of how many hours they work, wich I can read and use for calculation. Also i have made a GUI with 2 date pickers that calculate the difference in days between them, keeping in mind that the weekend is not a work day. The difference I multiply by 8 to calculate how many hours needs to be registered, here lies my problem when someone is working 3 days a week it should not be showing 40 hours but only 24 hours. I'm hoping that there is a way to do this. The hours per week a written down in a ini file: [Uren] PerWeek=24 //Hours per week Vakantie=0 //Vacation hours Extra=0 //Extra days Gebruikers.ini: [Mark Wingens] Afdeling=Optics ID.ini: [ID] 1= Ziekmelding.ini: [ID] 15=15 [VAN] 15=2019/03/11 [TM] 15=2019/03/11 [AANTAL] 15=1 [UREN] 15=8 [REDEN] 15=Ziek melding [OPMERKING] 15=test ziekmelding [Accoderen] 15=Ja Code: $ZiekmeldingAanvr = GUICreate("Ziek melding", 437, 193, -1, -1, $WS_POPUPWINDOW) GUICtrlCreateLabel("Ziek melding", 296, 40, 133, 34) GUICtrlSetFont(-1, 16, 800, 0, "Segoe UI") GUICtrlSetColor(-1, 0x000000) GUICtrlCreateLabel("Van", 16, 42, 23, 17) $VanDatum = GUICtrlCreateDate("", 88, 40, 186, 21) GUICtrlCreateLabel("Tot en met", 16, 74, 55, 17) $TMDatum = GUICtrlCreateDate("", 88, 72, 186, 21) GUICtrlCreateLabel("Aantal uren", 16, 106, 67, 17) $AantalDagen = GUICtrlCreateInput("", 88, 104, 186, 21) GUICtrlCreateLabel("Opmerking", 16, 138, 55, 17) $Opmerking = GUICtrlCreateInput("", 88, 136, 334, 21) GUICtrlCreateLabel("Medewerker", 16, 10, 63, 17) $Gebruikers = GUICtrlCreateCombo("", 88, 8, 186, 25, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL)) $Opslaan = GUICtrlCreateButton("Opslaan", 259, 160, 75, 25) $Sluiten = GUICtrlCreateButton("Annuleren", 347, 160, 75, 25) Local $sStyle = "yyyy/MM/dd" GUICtrlSendMsg($VanDatum, $DTM_SETFORMATW, 0, $sStyle) GUICtrlSendMsg($TMDatum, $DTM_SETFORMATW, 0, $sStyle) GUICtrlSetState($VanDatum, $GUI_DISABLE) GUICtrlSetState($TMDatum, $GUI_DISABLE) GUICtrlSetState($AantalDagen, $GUI_DISABLE) GUICtrlSetState($Opmerking, $GUI_DISABLE) GUICtrlSetState($Opslaan, $GUI_DISABLE) GUISetState(@SW_SHOW) ; Get the sections of the ini file Global $aSections = IniReadSectionNames(@ScriptDir & "\DB\gebruikers.ini") ; If the IniReadSectionNames succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1] If (Not @error) Then GUICtrlSetData($Gebruikers, _ArrayToString($aSections, "|", 1), $aSections[1]) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Sluiten GUIDelete($ZiekmeldingAanvr) Hoofdmenu() ExitLoop Case $Gebruikers $GO = 1 If GUICtrlRead($Gebruikers) = "Kies een medewerker..." Then MsgBox(4096, "Let op!", "Kies een medewerker.") $GO = 0 EndIf If $GO = 1 Then GUICtrlSetState($VanDatum, $GUI_ENABLE) GUICtrlSetState($TMDatum, $GUI_ENABLE) GUICtrlSetState($AantalDagen, $GUI_ENABLE) GUICtrlSetState($Opmerking, $GUI_ENABLE) GUICtrlSetState($Opslaan, $GUI_ENABLE) $Start_Date = GUICtrlRead($VanDatum) $End_Date = GUICtrlRead($TMDatum) Local $DT = $Start_Date, $iCount = 0, $Y, $M, $D While $DT <= $End_Date $Y = StringRegExpReplace($DT, "(\d+)/.*", "$1") $M = StringRegExpReplace($DT, ".*/(\d+)/.*", "$1") $D = StringRegExpReplace($DT, ".*/(\d+)", "$1") If _DateToDayOfWeek($Y, $M, $D) <> 1 And _DateToDayOfWeek($Y, $M, $D) <> 7 Then $iCount += 1 EndIf $DT = _DateAdd("D", 1, $DT) WEnd $Aantalurenverlof = $iCount * 8 GUICtrlSetData($AantalDagen, $Aantalurenverlof) EndIf Case $VanDatum $Start_Date = GUICtrlRead($VanDatum) $End_Date = GUICtrlRead($TMDatum) Local $DT = $Start_Date, $iCount = 0, $Y, $M, $D While $DT <= $End_Date $Y = StringRegExpReplace($DT, "(\d+)/.*", "$1") $M = StringRegExpReplace($DT, ".*/(\d+)/.*", "$1") $D = StringRegExpReplace($DT, ".*/(\d+)", "$1") If _DateToDayOfWeek($Y, $M, $D) <> 1 And _DateToDayOfWeek($Y, $M, $D) <> 7 Then $iCount += 1 EndIf $DT = _DateAdd("D", 1, $DT) WEnd $Aantalurenverlof = $iCount * 8 GUICtrlSetData($AantalDagen, $Aantalurenverlof) Case $TMDatum $Start_Date = GUICtrlRead($VanDatum) $End_Date = GUICtrlRead($TMDatum) Local $DT = $Start_Date, $iCount = 0, $Y, $M, $D While $DT <= $End_Date $Y = StringRegExpReplace($DT, "(\d+)/.*", "$1") $M = StringRegExpReplace($DT, ".*/(\d+)/.*", "$1") $D = StringRegExpReplace($DT, ".*/(\d+)", "$1") If _DateToDayOfWeek($Y, $M, $D) <> 1 And _DateToDayOfWeek($Y, $M, $D) <> 7 Then $iCount += 1 EndIf $DT = _DateAdd("D", 1, $DT) WEnd $Aantalurenverlof = $iCount * 8 GUICtrlSetData($AantalDagen, $Aantalurenverlof) Case $Opslaan $GO = 1 $VAR = _DateDiff('D', GUICtrlRead($VanDatum), GUICtrlRead($TMDatum)) If $VAR < 0 Then MsgBox(4096, "Let op!", "Controleerde ingevoerde data." & @CRLF & @CRLF & "Van datum:" & @TAB & GUICtrlRead($VanDatum) & @CRLF & "Tot en met datum:" & @TAB & GUICtrlRead($TMDatum)) $GO = 0 EndIf If $GO = 1 Then Local $AfdelingTemp = IniRead(@ScriptDir & "\DB\Gebruikers.ini", GUICtrlRead($Gebruikers), "Afdeling", "") GUICtrlSetState($VanDatum, $GUI_DISABLE) GUICtrlSetState($TMDatum, $GUI_DISABLE) GUICtrlSetState($AantalDagen, $GUI_DISABLE) GUICtrlSetState($Opmerking, $GUI_DISABLE) GUICtrlSetState($Opslaan, $GUI_DISABLE) GUICtrlSetState($Sluiten, $GUI_DISABLE) $VAR = GUICtrlRead($VanDatum) $YEAR = StringLeft($VAR, 4) $aArray = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ID.ini", "ID") $count = UBound($aArray, 1) $VAR = $count + 1 $Dagen = GUICtrlRead($AantalDagen) / 8 $Dagen = Round($Dagen, 3) $Replace = StringRegExpReplace(GUICtrlRead($AantalDagen), ",", ".") IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ID.ini", "ID", $VAR, "") IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "ID", $VAR, $VAR) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "VAN", $VAR, GUICtrlRead($VanDatum)) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "TM", $VAR, GUICtrlRead($TMDatum)) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "AANTAL", $VAR, $Dagen) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "UREN", $VAR, $Replace) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "REDEN", $VAR, "Ziek melding") IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "OPMERKING", $VAR, GUICtrlRead($Opmerking)) IniWrite(@ScriptDir & "\DB\Gebruikers\" & $AfdelingTemp & "\" & GUICtrlRead($Gebruikers) & "\Jaren\" & $YEAR & "\ziekmelding.ini", "Accoderen", $VAR, "Ja") Global $ZiekMedewerker = GUICtrlRead($Gebruikers) Global $ZiekEmail = IniRead(@ScriptDir & "\DB\gebruikers.ini", $ZiekMedewerker, "Email", "") Global $ZiekVan = GUICtrlRead($VanDatum) Global $ZiekTM = GUICtrlRead($TMDatum) Ziekmeldingmail() Sleep(250) MsgBox(4096, "Opgeslagen", "De ziek melding is opgeslagen.") Sleep(100) GUIDelete($ZiekmeldingAanvr) ZiekmeldingAanvr() ExitLoop EndIf EndSwitch WEnd EndFunc ;==>ZiekmeldingAanvr
  13. This one worked for me: $aVAR = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $NAAMMEDEWERKER & "\Jaren\" & $VAR & "\vrijvragen.ini", "AANTAL") $sum = 0 For $i = 1 to $aVAR[0][0] $SUM = $SUM + $aVAR[$i][1] Next Thank you all for the support!
  14. My code of what i have tried. $aVAR = IniReadSection(@ScriptDir & "\DB\Gebruikers\" & $NAAMMEDEWERKER & "\Jaren\" & $VAR & "\vrijvragen.ini", "AANTAL") _ArrayDisplay($aVAR) $test = _ArrayToString($aVAR,"|","","","",1) MsgBox(4096, "Test", $test) For $i = 1 to $aVAR[0][0] $Test = $aVAR[$i][$i] + $aVAR[$i][$i] Next MsgBox(4096, "Done", $Test) Exit a bit more informations the col1 is always the samen the rows are variable some times it shows 1 or 2 rows sometimes it shows a lot more.
  15. Hi, i am reading out an section of a ini file and this is the array i am getting. What i am trying to get is a sum of al the values in Col1 in the example i would like to get a variable stored with the number 6 It this possible?
×
×
  • Create New...