Sign in to follow this  
Followers 0
swstrau118

Time People Schedule Help!

3 posts in this topic

I am trying to write a script that will eventually go into a GUI but for now I'm just trying to get the script to run. I am trying to see "Who's Working" according to the times. I am having trouble with the overlap. If the end of someone's shift is 3pm but you're coming in at 1pm I can't view the two people only one. Also Trying to figure out how correlate people with dates (haven't been able to figure out how to put that in for the whole month) and when I'm calling the times can I do 17:30? I have issues with that as well. Any help would be greatly appreciated! 

Attached is the txt file that should be on the Desktop and the au3 code. but I'll paste the code in here as well.

; Determine workgroup and shift  (These are hardcoded here but can be determined any way you want)
Local $workgroupName = _WorkGroup()
Local $shift = _Time()

; Build header to search the text file for
Local $contactHeader = $workgroupName & $shift

; Declare variable to hold the body of the contact info to display
Local $contactBody = ""

; Create file handle
Local $file = FileOpen(@DesktopDir & "\ContactInfo.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    ; Read line
    Local $line = FileReadLine($file)
    ;Handle Error
    If @error = -1 Then ExitLoop
    
    ; search for workgroup header
    if $line = $contactHeader then
    
        ; Read next line
        $line = FileReadLine($file)
        
        ; Build contact info body until terminator is reached
        Do      
            ; Add current line to contact body plus a carriage return ASCII code 
            ;   so that a new line begins next time through the loop
            $contactBody = $contactBody & $line & chr(13)
            ; Read next line
            $line = FileReadLine($file)
        
        Until $line = ";"
    
        ; Exit while loop to read file
        ExitLoop
    
    EndIf
    
WEnd

; Close file
FileClose($file)

; Populate label for message box
Local $contactString = "Workgroup: " & _WorkGroup() & chr(13)
$contactString = $contactString & "Shift: " & _Time() & chr(13) & chr(13)
$contactString = $contactString & $contactBody

; Display message box
MsgBox(4096, "Contact Info", $contactString)

Func _Time()
    Local $AMPM, $hour
    If @HOUR <= 05 Then
        $hour = ("Night")
    ElseIf @hour >= 18 Then
        $hour = ("Night")
    ElseIf
        $hour = ("Day")
    EndIf
    Return $hour
EndFunc ;==>_Time

Func _WorkGroup()
    Local $AMPM, $hour
    If @HOUR >= 02 And @HOUR <=11 Then
        $hour = ("Workgroup2")
    ElseIf @HOUR >= 10 And @HOUR <= 19  Then
        $hour = ("Workgroup3")
    ElseIf @HOUR >= 23 And @HOUR <= 08 Then
        $hour = ("Workgroup1")
    EndIf
    Return $hour
EndFunc ;==>_Time

ContactInfo.au3

ContactInfo.txt

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It sounds like you're trying to manage employee times and contact data.  Wouldn't you be better off using MS Access, MS Excel, or another program to view/manage all that data?  I have personally used both Access & Excel, and they're good at what they do (and VB has a built-in datatype for handling time/dates).  You can do this in AutoIt if you like, but it's usually better not to reinvent the wheel.  If you want to use AutoIt anyway, check out the UDF called Date.au3 in your Include directory (or Help File -> UDFs -> Date Management).  You'll find lots of useful functions there.

Edited by Artisan

Share this post


Link to post
Share on other sites

See I get all that information sent every month that is on an Excel spreadsheet with 6 different tabs. I was going to have all that information put on one tab then pull that data into a text file and you could hit a button and it wil show you these people (according to the time[i got that figured out] and date[no clue how to do this one] display who is working. The information needs to be access quickly and would be put into a GUI that i created that houses buttons that link to different information so it's easier and faster to access. I'm just stuck on how to refer this to the dates for each month..

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  
Followers 0

  • Similar Content

    • natedog102
      By natedog102
      This small UDF helps you save any text to speech to a .wav file. 
      UDF:
      #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include-once ; #INDEX# ======================================================================================================================= ; Title .........: _TTStoWav() ; AutoIt Version : 3.3.14.2 ; Language ......: English ; Author(s) .....: natedog102 ; Modifiers .....: ; Forum link ....: https://www.autoitscript.com/forum/topic/191573-tts-text-to-speech-to-wav-file-using-sapi/ ; Description ...: TTS to .wav file using SAPI ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _TTStoWav ; Description ...: TTS to .wav file using SAPI ; Syntax.........: _TTStoWav($sText, $sLocation[, $iRate = 1[, $iVolume = 100]]) ; Parameters ....: $sText - String you want converted to a .wav ; $sLocation - Save location + file name, example: "C:\folder\sample.wav" ; $iRate - TTS speak rate between -10 and 10 ; $iVolume - Volume of the TTS between 0 and 100 ; Return values .: Success - Returns one ; Failure - Returns zero ; Author ........: natedog102 ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TTStoWav($sText, $sLocation, $iRate = 1, $iVolume = 100) $oFileStream = ObjCreate("SAPI.SpFileStream") If @error Then Return 0 EndIf $oFileStream.Format.Type = 39 $oFileStream.Open($sLocation, 3) $oSpeech = ObjCreate('SAPI.SpVoice') If @error Then Return 0 EndIf $oSpeech.AudioOutputStream = $oFileStream $oSpeech.Rate = $iRate $oSpeech.Volume = $iVolume $oSpeech.Speak($sText, 3) $oSpeech.WaitUntilDone(10000) $oFileStream.Close() Return 1 EndFunc ;==>_TTStoWav And here's example usage:
      _TTStoWav("This is a test", "C:\folder-must-exist\sample2.wav") I have never made a UDF before so I don't know if I coded it correctly or if I followed all the recommended guidelines. Apologies if I haven't.
      DOWNLOAD:
       _TTStoWav.au3
    • nacerbaaziz
      By nacerbaaziz
      hello
      please i need to link a progress bar with a time can you help me?
      e.g
      i want to set a progress bar for 10 sec
      am waiting for your answers
      thank you.
    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Guys this is my gui and i need the numeric value typed in the highlighted  inputbox. if this value is greater than 1 i need to perform some operations
      \
       
      Here is the summary about that field which i got from wininfo tool

      i tried writing the code as shown below.. but the msgbox is popping up empty value..when the same code is pasted under some button action i am able to access the value present in the field..but when placed alone as written in the attached script i am unable to fetch it... 

      here i am using the valu present in the field

      can you guys tell me what's wrong??? or how can i get that value?
       
      My_GUI.au3

    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      in need the path/text present int above shown input box to be copied or retrieved into a variable .. how can i do that?
       
      Thanks
       
    • Shirdish_chakravarthi
      By Shirdish_chakravarthi
      Hello Friends i am new to autoit and i am stuck in middle of automation of flashing tool..
      my requirement is i have a window and i have to get the value present in that window (below is the picture)

      in the above window i need to get the value of the highlighted field.the value of this filed keeps on changing...ii need to get the current value present in the field..below are the details of the window and field..

       
      CAN it be done?
       
      thanks