Sign in to follow this  
Followers 0
nitekram

learning scriptin

15 posts in this topic

#1 ·  Posted (edited)

I have written this with the help of many - SmOke_n, gafrost to a name a few.

This is a logger of sorts - not a key logger but a phone call logger.

I have attached the example txt file that the logger reads to get info.

What I am looking for is feedback - something that I made way to hard, something that looks wrong, I want to learn and if you guys can tear it apart - at least I will learn from it.

before you say anything about the variable names - i know i have that to still work on

For this test - only 08/01/06 - 08/04/06 and extension 507, 509, 511 will work 507 has the most entrys

Thanks for anyones help and those that have already helped me.

#Region Includes/Variables
#include <Date.au3>

Global $ShowTimeAdmin = 0, $GotInput = 0, $FileLine
Global $TotalCalls = 0, $CallsIn = 0, $CallsOut = 0, $InputExt, $GetFileDate = 0
Global $InputDate, $TotalCallsTimer = 0, $CallTimeTotal = "00:00:00"
Global $Day
Global $FoundExtInString = 0
Global $FileLine
#EndRegion

#Region Main Loop/Funcs
While 1
    Main()
    $TotalCalls = 0
    $CallsIn = 0
    $CallsOut = 0
    $InputExt = 0
    $GetFileDate = 0
    $InputDate = 0
    $TotalCallsTimer = 0
    $CallTimeTotal = "00:00:00"
    $ShowTimeAdmin = 0
WEnd

Func Main()
    $file = FileOpen("logger.TXT", 0)
    ; Check if file opened for reading OK
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    If $GotInput = 0 Then
        GetDateAndExt()
        $GotInput = 1
    EndIf
    ; Read File until the EOF is reached
    While 1
        $FileLine = FileReadLine($file)
        If @error = -1 Then ExitLoop
        _Ext()
    WEnd
    
    If $GotInput = 1 Then DisplayLoggerData()
    $GotInput = 0
    FileClose($file)
EndFunc   ;==>Main
#EndRegion


#Region Other Funcs
Func GetDateAndExt()
    If $GotInput = 0 Then
        $InputDate = InputBox("Enter Date", "Please enter a date to search for:", _NowDate(), " 10", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0 ;OK - The string returned is valid
                
            Case @error = 1 ;The Cancel button was pushed
                Exit
            Case @error = 3 ;The InputBox failed to open
                
        EndSelect
        ;Input EXTENSION
        
        $InputExt = InputBox("Enter Extension", "Please enter an extension to search for:", "507", " 3", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0 ;OK - The string returned is valid
                
            Case @error = 1 ;The Cancel button was pushed
                Exit
            Case @error = 3 ;The InputBox failed to open
                
        EndSelect
        
        ;ADMIN
        If StringLeft($InputExt, 1) = '6' Then
            $ShowTimeAdmin = 1
            $InputExt = "5" & StringRight($InputExt, 2)
            MsgBox(0,"","")
        EndIf
        
        ; add the 0 (zero) in front of the first 9 months
        If StringLeft($InputDate, 1) <= 9 Then $InputDate = "0" & $InputDate
        ; test the date DAY is greater than 9 or add a zero
        If StringMid($InputDate, 3, 1) <= '/' And StringMid($InputDate, 5, 2) <= '/2' Then
            $Day = StringMid($InputDate, 4, 1)
            If $Day <= 9 Then
                $seperator = StringSplit($InputDate, '/')
                If $seperator[2] <= 9 Then
                    $seperator[2] = "0" & $seperator[2]
                    ; Blank out the input date to use new formated date
                    $InputDate = ""
                    For $i = 1 To $seperator[0]
                        If $i >= 2 Then
                            $InputDate = $InputDate & '/' & $seperator[$i]
                        Else
                            $InputDate = $InputDate & $seperator[$i]
                        EndIf
                    Next
                EndIf
            EndIf
        EndIf
        
        If StringLen($InputDate) = 10 Then $InputDate = StringLeft($InputDate, 6) & StringRight($InputDate, 2)
        
        ; add the spaces to the extension so that it does not search for phone numbers
        $InputExt = " " & $InputExt & " "
    Else
        MsgBox(0, "ERROR", "NOT SURE")
        $GotInput = 1
    EndIf
EndFunc   ;==>GetDateAndExt

Func _Ext()
    $GetFileDate = StringMid($FileLine, 3, 8)
    ;MsgBox(0,$GetFileDate,$InputDate)
    If $GetFileDate = $InputDate Then
        $FoundExtInString = 0
        $FoundExtInString = StringInStr($FileLine, $InputExt)
        If $FoundExtInString > 1 Then $TotalCalls = $TotalCalls + 1
        
        $ExtCallIn = StringLeft($FileLine, 1)
        $ExtCallOut = StringLeft($FileLine, 1)
        
        If $ExtCallIn = "I" And $FoundExtInString > 1 Then $CallsIn = $CallsIn + 1
        If $ExtCallOut = "C" And $FoundExtInString > 1 Then $CallsOut = $CallsOut + 1
        If $ShowTimeAdmin = 1 And $FoundExtInString > 1 Then $displaytime = counttime()
    EndIf
EndFunc   ;==>_Ext


Func counttime()
    ;$TotalCallsTimer = StringMid($FileLine, 38, 8) ; used for real file - everything including the phone numbers
    $TotalCallsTimer = StringMid($FileLine, 17, 8) ; example file only
    $CallTimeTotal = _AddTime($CallTimeTotal, $TotalCallsTimer)
EndFunc   ;==>counttime

Func _AddTime($sTime1, $sTime2) ; Special thanks to SmOke_n for this code
    Local $aSplit1 = StringSplit($sTime1, ':')
    Local $aSplit2 = StringSplit($sTime2, ':')
    Local $nAddSec = 0, $nAddMin = 0, $nAddHour = 0
    
    $nAddSec += Int($aSplit1[3]) + Int($aSplit2[3])
    If $nAddSec > 59 Then
        $nAddMin = 1
        $nAddSec = $nAddSec - 60
    EndIf
    $nAddMin += Int($aSplit1[2]) + Int($aSplit2[2])
    If $nAddMin > 59 Then
        $nAddHour = 1
        $nAddMin = $nAddMin - 60
    EndIf
    $nAddHour += Int($aSplit1[1]) + Int($aSplit2[1])
    Return StringFormat('%02d', $nAddHour) & ':' & StringFormat('%02d', $nAddMin) & ':' & StringFormat('%02d', $nAddSec)
EndFunc   ;==>_AddTime

Func DisplayLoggerData()
    If $ShowTimeAdmin = 0 Then
        MsgBox(0, "Calls:", "Total Calls - EXT " & $InputExt & " on " & $InputDate & " = " & "( " & $TotalCalls & " )" & " Total In: " & $CallsIn & " Total Out: " & $CallsOut)
    Else
        MsgBox(0, "Call Time: " & $CallTimeTotal, "Total Calls - EXT " & $InputExt & " on " & $InputDate & " = " & "( " & $TotalCalls & " )" & " Total In: " & $CallsIn & " Total Out: " & $CallsOut)
    EndIf
    $GotInput = 0
EndFunc   ;==>DisplayLoggerData
#EndRegion

EDIT - NEW CODE

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites



Bump - any takers?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Do I need to clean the code up?

Do I need to get rid of the spaces in the code?

Is there an easier way to break out the date so I do not have to use so many if statements and string functions?

Should I just read every extension and then create check boxes - for each extension, making it easier on the person that is reading it, namely me?

Shoud I write the log file into a INI file first and then view/read it?

I am looking for something that will change the way I code, make be a better coder. I want to think like a programmer and write like one as well. Because when I create the code - I always want to change it afterwards, and in order to do that I have to change everything, not just the way it reads the info, but how it interacts with the user. I would like my functions to be able to be used in other areas of my code and for future projects.

I sure the hell want a lot of things - dont I. I guess I am just a really demanding person. Can anyone help me on that as well?

Most of the scripts or snibbets of code are taken right from the help file or by other AutoIt gurus and then changed to suit my needs. But if you noticed - in order for me to get more than extension at a time - I created these while loops and now I feel like - it works but it could be so much better. More friendly for future projects. I mean I am sure that I will be adding times again in the future. I guess what I need is a really good book or mentor that will help shape me into what I want to become, a programmer.

I know what you are thinking - just do it. But I will - I just want to do it right, not make the stupid mistakes that already show itself in my code. I went to try and change the code - to allow the person to pick a date from the calendar - and got stuck in my loops. And then when I commented out the areas that were looping I then realized that in order for me to change it - I would have to start all over. Well that is fine, but I would like to have been able to do that and still use my other code. How do you make code that will be usefull in the future.

Any takers?

EDIT changed some spacing.

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

how I clean up my code

In SciTE:

Tools>>Tidy

Use this code:

#Region *Name here*
;foo
#EndRegion

Share this post


Link to post
Share on other sites

Do I need to get rid of the spaces in the code?

nitekram,

When I ran "Cleanup Script Whitespace" under "Tools" in SciTE, I got the following message:

Removed trailing spaces from 23 line(s).

Tabsize:4

Fixed indentation for 116 line(s).

taurus905

"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

nitekram,

When I ran "Cleanup Script Whitespace" under "Tools" in SciTE, I got the following message:

taurus905

I had no clue about that tool - does it just remove spaces between lines or spaces at the end of lines?

Aslo I looked for #Region under help file - did not find much. can someone explain?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I had no clue about that tool - does it just remove spaces between lines or spaces at the end of lines?

Aslo I looked for #Region under help file - did not find much. can someone explain?

nitekram,

It only removes whitespace (spaces and tabs, if I'm not mistaken) from the end of the lines. I noticed that if I run "Cleanup Script Whitespace" on your original code and then run "Tidy AutoIt Source" on your original code, they do almost the same thing. But "Tidy AutoIt Source" does not clean the whitespace at the end of the 23 lines.

This is a handy freeware program to compare files:

ExamDiff 1.6n

http://www.download.com/ExamDiff/3000-2248_4-10059626.html

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I looked for #Region under help file - did not find much. can someone explain?

'#Region' doesn't do much except make your source code easier to read and follow, more for people than the computer itself

But, as an example on your script

#Region Includes/Variables
#include <Date.au3>
Global $test1 = 1, $testhour, $displaytime = 0, $time = 0, $done = 0, $line, $iSub
Global $count507 = 0, $countIn507 = 0, $countOut507 = 0, $chars507, $date507 = 0, $lastdate507 = $test1, $date507test, $counttimer = 0, $counttimertotal = "00:00:00"
Global $test
#EndRegion

#Region Main Loop/Funcs
While 1
    main()
    $count507 = 0
    $countIn507 = 0
    $countOut507 = 0
    $chars507 = 0
    $date507 = 0
    $lastdate507 = $test1
    $date507test = 0
    $counttimer = 0
    $counttimertotal = "00:00:00"
    $time = 0
WEnd
Func main()
    $file = FileOpen("logger.TXT", 0)
    Global $result = 0, $line
    ; Check if file opened for reading OK
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    If $done = 0 Then
        getInput()
        $done = 1
    EndIf
    ; Read File until the EOF is reached
    While 1
        $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        _507()
    WEnd

   
   
    If $done = 1 Then displayCount()
    $done = 0
    FileClose($file)
EndFunc   ;==>main
#EndRegion


#Region Other Funcs

Func getInput()
    If $done = 0 Then
        $date507test = InputBox("Enter Date", "Please enter a date to search for:", _NowDate(), " 10", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0 ;OK - The string returned is valid
               
            Case @error = 1 ;The Cancel button was pushed
                Exit
            Case @error = 3 ;The InputBox failed to open
               
        EndSelect
        ;Input EXTENSION
       
        $chars507 = InputBox("Enter Extension", "Please enter an extension to search for:", "507", " 3", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0 ;OK - The string returned is valid
               
            Case @error = 1 ;The Cancel button was pushed
                Exit
            Case @error = 3 ;The InputBox failed to open
               
        EndSelect
       
        ;ADMIN
        If StringLeft($chars507, 1) = '6' Then
            $time = 1
            $chars507 = "5" & StringRight($chars507, 2)
        EndIf
       
        ; add the 0 (zero) in front of the first 9 months
        If StringLeft($date507test, 1) <= 9 Then $date507test = "0" & $date507test
       
       
        ; test the date DAY is greater than 9 or add a zero
        If StringMid($date507test, 3, 1) <= '/' And StringMid($date507test, 5, 2) <= '/2' Then
            $test = StringMid($date507test, 4, 1)
            If $test <= 9 Then
                $seperator = StringSplit($date507test, '/')
                If $seperator[2] <= 9 Then
                    $seperator[2] = "0" & $seperator[2]
                   
                    $date507test = ""
                   
                    For $i = 1 To $seperator[0]
                        If $i >= 2 Then
                            $date507test = $date507test & '/' & $seperator[$i]
                        Else
                            $date507test = $date507test & $seperator[$i]
                        EndIf
                    Next
                EndIf
            EndIf
           
           
           
        EndIf
       
        If StringLen($date507test) = 10 Then $date507test = StringLeft($date507test, 6) & StringRight($date507test, 2)
       
        ; add the spaces to the extension so that it does not search for phone numbers
        $chars507 = " " & $chars507 & " "
    Else
        MsgBox(0, "ERROR", "NOT SURE")
        $done = 1
    EndIf
   
   
   
EndFunc   ;==>getInput

Func _507()
    $date507 = StringMid($line, 3, 8)
    ;MsgBox(0,$date507,$date507test)
    If $date507 = $date507test Then
        $result = 0
        $result = StringInStr($line, $chars507)
        $callIn507 = StringLeft($line, 1)
        $callOut507 = StringLeft($line, 1)
        If $result > 1 Then $count507 = $count507 + 1
        If $callIn507 = "I" And $result > 1 Then $countIn507 = $countIn507 + 1
        If $callOut507 = "C" And $result > 1 Then $countOut507 = $countOut507 + 1
        If $time = 1 And $result > 1 Then $displaytime = counttime()
    EndIf
    $test1 = 0
EndFunc   ;==>_507
;I 07/12/06 08:46                 IN* 00:00:28   805   44
Func counttime()
    $counttimer = StringMid($line, 38, 8)
    $counttimertotal = _AddTime($counttimertotal, $counttimer)
    ;$counttimertotal = _StrAddSub($counttimertotal, $counttimer,1)
EndFunc   ;==>counttime

Func _AddTime($sTime1, $sTime2)
    Local $aSplit1 = StringSplit($sTime1, ':')
    Local $aSplit2 = StringSplit($sTime2, ':')
    Local $nAddSec = 0, $nAddMin = 0, $nAddHour = 0
   
    $nAddSec += Int($aSplit1[3]) + Int($aSplit2[3])
    If $nAddSec > 59 Then
        $nAddMin = 1
        $nAddSec = $nAddSec - 60
    EndIf
    $nAddMin += Int($aSplit1[2]) + Int($aSplit2[2])
    If $nAddMin > 59 Then
        $nAddHour = 1
        $nAddMin = $nAddMin - 60
    EndIf
    $nAddHour += Int($aSplit1[1]) + Int($aSplit2[1])
    Return StringFormat('%02d', $nAddHour) & ':' & StringFormat('%02d', $nAddMin) & ':' & StringFormat('%02d', $nAddSec)
EndFunc   ;==>_AddTime


Func displayCount()
    If $time = 0 Then
        MsgBox(0, "Calls:", "Total Calls - EXT " & $chars507 & " on " & $date507test & " = " & "( " & $count507 & " )" & " Total In: " & $countIn507 & " Total Out: " & $countOut507)
    Else
        MsgBox(0, "Call Time: " & $counttimertotal, "Total Calls - EXT " & $chars507 & " on " & $date507test & " = " & "( " & $count507 & " )" & " Total In: " & $countIn507 & " Total Out: " & $countOut507)
    EndIf
    $done = 0
EndFunc   ;==>displayCount
#EndRegion

In SciTE it lets you expand/collapse the regions you want/don't want to look at respectivly

I can make the whole code 4 lines!

though it doesn't make a difference in performance

For me, it makes big scripts easier to follow as opposed to doing like

;==============Title Here===============

Its like making a #cs/#ce for code that you actually want to include

Edited by Paulie

Share this post


Link to post
Share on other sites

OK I have saved your code - how do you expand/collapse the code? sorry as you can tell I just learned about clean white space - but I did not see collapse expand region.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

OK I have saved your code - how do you expand/collapse the code? sorry as you can tell I just learned about clean white space - but I did not see collapse expand region.

In SciTe4Autoit3, you just click on the +/- sign next to the "#Region" line

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

In SciTe4Autoit3, you just click on the +/- sign next to the "#Region" line

I feel more stupid now - thanks

EDIT - not from you

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

nitekram,

If I were you, priority-wise, first I would cleanup my variables (which you know needs it) and then I would change the date selection using GUICtrlCreateMonthCal. (I didn't test this, so I hope it is the right one to use.) And maybe even restrict the range using the earliest and latest dates.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

nitekram,

If I were you, priority-wise, first I would cleanup my variables (which you know needs it) and then I would change the date selection using GUICtrlCreateMonthCal. (I didn't test this, so I hope it is the right one to use.) And maybe even restrict the range using the earliest and latest dates.

taurus905

OK - I have updated both variables and function names - in first thread. I hope that this is cleaner and easier to read - it is for me. Since I wrote this over a period of time, going back to rename the variables was a lot harder than I thought it would be. Learned a valuable lesson about naming variables for the future - might as well really name them and not use names like $test1, $test2, etc. Thanks for the suggestion.

I have also added the #Region - which makes things real easy on the eyes when trying to look at different parts of the code, as well as not having to use the page up and page down key for ever on longer code.

I think in order to use the GuiCtrlCreateDate - I would have to design a GUI - this is what I think my planning for this is bad. I should have thought it through and tried the gui first. But how do you design code - just the code and then add a GUI later? I would think that it would be impossible for more than one person to work on a program, but it happens all the time. How do they do it - each writing a piece of code and then adding it to the main code?

Any takers?

And thanks for those that got me going down this path.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

Well, I thought I changed my code in the first post, but after reading it again, only certain parts were changed. I am still looking for changes or other helpful hints.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

Well, I thought I changed my code in the first post, but after reading it again, only certain parts were changed. I am still looking for changes or other helpful hints.

Bump - when I posted this, I forgot that the line changed size - I have fixed it so now it should read the time if you input a 6 instead of a 5 in 507, 509, 511 - this is for the admin section, so incase a manager want to check the time used for the calls.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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