Jump to content
Sign in to follow this  
swstrau118

Time People Schedule Help!

Recommended Posts

swstrau118

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
Artisan

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
swstrau118

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  

  • Similar Content

    • cramaboule
      By cramaboule
      Hi all,
       
      I was wondering if it is possible (and how) to put text on video on-the-fly (like VLC displays Title movie at the begining)
      and of course doing that in AutoIt
      Thanks in advance...
       
      C.
    • Jemboy
      By Jemboy
      Hi,
      Ones(some times twice) a month I get an e-mail with zip file, which has price updates from a supplier.
      I have to upload the file to an FTP to get it processed.
      When uploading the file, it will get "timestamped" with the time and date at which time the file was uploaded.
      Normally this is fine, because I mostly upload the file the same day.
      Sometimes it may take 1 or 2 days before I can upload the file.
      For historical purpose, I would like to have the file timestamped with the original date.
      I have tried using:  _FTP_Command ( $hFTPSession, "MFCT YYYYMMDDHHMMSS path") 
      however this command does not work or change the timestamp as I expected.
      Does anyone now a way how I can change the timestamp of a FTP-file?
    • reida
      By reida
      Hello. On page there is mail address. How to keep in a text file this address? 
      It is page and email
      https://alpari.com/
      info@alpari.com
    • caramen
      By caramen
      Hey.  
       
      I requested help about how to get a value from a text in a variable. 
      Now i know how to do that. But i learned with the command FileRead. Now i whould like to know how to replace the command :
      FileRead('Dossier.txt') The purpose is to read a webpage text. To find some value inside. 
       
      Btw i tryed to play with WindowsInfo.au3 but i dont got much thing.  
    • Rskm
      By Rskm
      Hi, for a script of mine, I wish to keep a time frame on till how the program will work.. basically, I want the program to read the date and if the read date < 'a particular date', the program continues, else it exit. I don't want to read the time from the computer as the program can be fooled by resetting the pc time. is there a way to read time from internet - so that the user cannot fool the program by date reset? thanks
×