Jump to content

I am making a program to retrieve Google Calendar data.


 Share

Recommended Posts

So far it is going well, just using the private XML link in the goggle settings for your calendar. It uses that and gets the info from the xml file. Then calculates and re-orders the data for view. I am still working on it but wanted some feedback if you think I am doing or going about doing something either wrongly, inefficiently etc. I like to think I am a pretty good coder of autoit but I do have a habbit of "ghetto-rigging" things to work if I have no better method.

Script:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Goocal.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <string.au3>
#include <inet.au3>
#include <File.au3>
#include <date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#NoTrayIcon
Global $count, $entries, $currentrecord, $numberof, $thetitle, $thedescription, $thewhen
 
$ini = FileOpen(@ScriptDir & '\GooCal Settings\Settings.ini', 9)
FileClose($ini)
If FileGetSize(@ScriptDir & '\GooCal Settings\Settings.ini') < 5 Then
$url = InputBox('Enter URL', 'Enter the URL to your Google calendar XML file.', '')
$theurl = StringStripWS($url, 8)
IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', $theurl)
 
EndIf
$entryamountreceived = FileOpen(@ScriptDir & '\GooCal Settings\Entry amount received last.txt', 9)
GetRawData()
ExtractDataThenSave()
 
#region ### START Koda GUI section ### Form=C:\Users\techwg\calendar.kxf
Global $guiCalendar = GUICreate("GooCal V1", 451, 339, 192, 124)
Global $ButtonPrevious = GUICtrlCreateButton("Previous", 184, 248, 59, 25)
Global $ButtonNext = GUICtrlCreateButton("Next", 312, 248, 59, 25)
Global $ButtonRefresh = GUICtrlCreateButton("Refresh", 249, 248, 59, 25)
$Group1 = GUICtrlCreateGroup("", 16, 208, 161, 65)
$minutes = GUICtrlCreateInput("5", 47, 243, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
$Label6 = GUICtrlCreateLabel("Auto Refresh Delay", 24, 223, 114, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Minutes", 119, 243, 48, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 16, 32, 415, 169)
Global $guiDescription = GUICtrlCreateEdit("", 162, 112, 255, 73, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY))
Global $guiWhen = GUICtrlCreateInput("", 162, 72, 255, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
Global $guiTitle = GUICtrlCreateInput("", 162, 48, 255, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))
$Label1 = GUICtrlCreateLabel("Entry Title ----", 74, 48, 82, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Entry Date / Time ----", 31, 72, 125, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Entry Description ----", 35, 112, 121, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label4 = GUICtrlCreateLabel("Google Calendar Offline Backup Access", 72, 8, 251, 24)
GUICtrlSetFont(-1, 12, 800, 0, "Arial Narrow")
RetrieveData()
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$timer = TimerInit()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $ButtonNext
   If $currentrecord <= ($numberof[0] - 1) Then
    $currentrecord += 1
    RetrieveData()
   EndIf
  Case $ButtonPrevious
   If $currentrecord >= 2 Then
    $currentrecord -= 1
    RetrieveData()
   EndIf
  Case $ButtonRefresh
   GetRawData()
   ExtractDataThenSave()
   RetrieveData()
  Case Else
   If TimerDiff($timer) >= ((GUICtrlRead($minutes) * 60) * 1000) Then
    GetRawData()
    ExtractDataThenSave()
    RetrieveData()
    $timer = TimerInit()
   EndIf
   Sleep(10)
 
EndSwitch
WEnd
 
Func RetrieveData()
Global $numberof = IniReadSectionNames(@ScriptDir & '\GooCal Settings\Current Entries.ini')
If Not $currentrecord Then $currentrecord = $numberof[0] / $numberof[0]
$thetitle = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Title', '')
$thewhen = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'When', '')
$thedescription = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Description', '')
GUICtrlSetData($guiTitle, $thetitle)
GUICtrlSetData($guiWhen, $thewhen)
GUICtrlSetData($guiDescription, $thedescription)
 
If $currentrecord = $numberof[0] Then
  GUICtrlSetState($ButtonNext, $GUI_DISABLE)
Else
  GUICtrlSetState($ButtonNext, $GUI_ENABLE)
EndIf
If $currentrecord = 1 Then
  GUICtrlSetState($ButtonPrevious, $GUI_DISABLE)
Else
  GUICtrlSetState($ButtonPrevious, $GUI_ENABLE)
EndIf
EndFunc   ;==>RetrieveData
 
Func GetRawData()
$datemin = _DateAdd('D', -1, @YEAR & '/' & @MON & '/' & @MDAY)
$datemax = _DateAdd('M', +6, @YEAR & '/' & @MON & '/' & @MDAY)
$urltocal = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', '')
$urltocal &= '?singleevents=true&start-max=' & StringReplace($datemax, '/', '-') & '&start-min=' & StringReplace($datemin, '/', '-')
 
Global $file = _INetGetSource($urltocal)
Global $entries = _StringBetween($file, '<entry>', '</entry>')
Global $count = UBound($entries)
EndFunc   ;==>GetRawData
 
Func ExtractDataThenSave()
If $count <> '' Or $count <> 0 Then
  If $count > 0 Then FileWrite($entryamountreceived, @CRLF & $count)
  $currententries = FileOpen(@ScriptDir & '\GooCal Settings\Current Entries.ini', 10)
  FileClose($ini)
  $create = $count + 10
  Global $sort[$create][2]
  For $entryretrieval = ($count - 1) To 0 Step -1
   $ID = _StringBetween($entries[$entryretrieval], '<ID>', '</ID>')
   $tmp = StringInStr($ID[0], 'morthawt.com')
   $ID = StringTrimLeft($ID[0], ($tmp + 12))
   $title = _StringBetween($entries[$entryretrieval], '<title type=''html''>', '</title>')
   If IsArray($title) Then $title = $title[0]
   $when = _StringBetween($entries[$entryretrieval], '<summary type=''html''>When: ', '&lt;br&gt;')
   If IsArray($when) Then $when = StringReplace($when[0], '&amp;nbsp;', '')
   $when = StringReplace($when, @LF, ' ')
   $sort[$entryretrieval][0] = $ID
   $contents = StringSplit($when, ' ')
   Select
    Case $contents[3] = 'Jan'
     $month = '01'
    Case $contents[3] = 'Feb'
     $month = '02'
    Case $contents[3] = 'Mar'
     $month = '03'
    Case $contents[3] = 'Apr'
     $month = '04'
    Case $contents[3] = 'May'
     $month = '05'
    Case $contents[3] = 'Jun'
     $month = '06'
    Case $contents[3] = 'Jul'
     $month = '07'
    Case $contents[3] = 'Aug'
     $month = '08'
    Case $contents[3] = 'Sep'
     $month = '09'
    Case $contents[3] = 'Oct'
     $month = '10'
    Case $contents[3] = 'Nov'
     $month = '11'
    Case $contents[3] = 'Dec'
     $month = '12'
   EndSelect
   $dayofyear = _DateDiff('D', $contents[4] & '/' & $month & '/' & $contents[2], $contents[4] & '/01/01')
   $dayofyear *= -1
   If _DateIsLeapYear($contents[4]) Then
    $daysthisyear = 366
   Else
    $daysthisyear = 365
   EndIf
 
   $decimalpercentofyear = $dayofyear / $daysthisyear
   $sort[$entryretrieval][1] = $contents[4] + $decimalpercentofyear
   $sort[$entryretrieval][0] = $ID
 
   $description = _StringBetween($entries[$entryretrieval], '&lt;br /&gt;Event Description: ', '</content>')
   If IsArray($description) Then $description = $description[0]
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'ID', $ID)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Title', $title)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'When', $when)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Description', $description)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'YearPosition', $contents[4] + $decimalpercentofyear)
 
  Next
 
  _ArraySort($sort, 1, 0, 0, 1)
  For $a = ($count - 1) To 0 Step -1
   $cOrderTitle = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Title', '0')
   $cOrderWhen = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'When', '0')
   $cOrderDescription = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Description', '0')
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Title', $cOrderTitle)
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'When', $cOrderWhen)
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Description', $cOrderDescription)
 
  Next
 
EndIf
EndFunc   ;==>ExtractDataThenSave

Do you have any opinions or observations about this code so far?

Thanks guys.

Link to comment
Share on other sites

This is the revised code:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Goocal.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <string.au3>
#include <inet.au3>
#include <File.au3>
#include <date.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#NoTrayIcon
Global $count, $entries, $currentrecord, $numberof, $thetitle, $thedescription, $thewhen, $simple, $month
$ini = FileOpen(@ScriptDir & '\GooCal Settings\Settings.ini', 9)
FileClose($ini)
If FileGetSize(@ScriptDir & '\GooCal Settings\Settings.ini') < 5 Then
$url = InputBox('Enter URL', 'Enter the URL to your Google calendar XML file.', '')
$theurl = StringStripWS($url, 8)
IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', $theurl)
EndIf
$entryamountreceived = FileOpen(@ScriptDir & '\GooCal Settings\Entry amount received last.txt', 9)

#Region ### START Koda GUI section ### Form=C:\Users\techwg\calendar3.kxf
Global $guiCalendar = GUICreate("GooCal V1", 539, 376, -1, -1)
Global $ButtonPrevious = GUICtrlCreateButton("&Previous", 264, 320, 59, 25, $WS_BORDER)
Global $ButtonNext = GUICtrlCreateButton("&Next", 392, 320, 59, 25, BitOR($BS_DEFPUSHBUTTON,$WS_BORDER))
Global $ButtonRefresh = GUICtrlCreateButton("Refresh", 329, 320, 59, 25, -1, $WS_EX_STATICEDGE)
$Group1 = GUICtrlCreateGroup("", 16, 296, 161, 65)
Global $minutes = GUICtrlCreateInput("5", 47, 331, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_NUMBER,$WS_BORDER))
$Label6 = GUICtrlCreateLabel("Auto Refresh Delay", 24, 311, 114, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Minutes", 119, 331, 48, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 16, 32, 505, 257)
Global $guiDescription = GUICtrlCreateEdit("", 162, 200, 345, 73, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xD7E4F2)
$Label1 = GUICtrlCreateLabel("Entry Title ----", 74, 56, 82, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Entry Date / Time ----", 31, 104, 125, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Entry Description ----", 35, 208, 121, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("Where at ----", 79, 152, 76, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Global $guiTitle = GUICtrlCreateEdit("", 162, 48, 345, 41, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xD7E4F2)
Global $guiWhen = GUICtrlCreateEdit("", 162, 96, 345, 41, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xD7E4F2)
Global $guiWhere = GUICtrlCreateEdit("", 162, 144, 345, 41, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetBkColor(-1, 0xD7E4F2)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label4 = GUICtrlCreateLabel("    Google Calendar Offline Backup Access    ", 129, 8, 283, 24, $SS_SUNKEN)
GUICtrlSetFont(-1, 12, 800, 0, "Arial Narrow")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GetRawData()
ExtractDataThenSave()
RetrieveData()
$timer = TimerInit()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $ButtonNext
   If $currentrecord <= ($numberof[0] - 1) Then
    $currentrecord += 1
    RetrieveData(1)
   EndIf
  Case $ButtonPrevious
   If $currentrecord >= 2 Then
    $currentrecord -= 1
    RetrieveData(1)
   EndIf
  Case $ButtonRefresh
   GetRawData()
   ExtractDataThenSave()
   RetrieveData()
  Case Else
   If TimerDiff($timer) >= ((GUICtrlRead($minutes) * 60) * 1000) Then
    GetRawData(1)
    ExtractDataThenSave(1)
    RetrieveData(1)
    $timer = TimerInit()
   EndIf
   Sleep(10)
EndSwitch
WEnd

Func RetrieveData($var = 0)
If $var = 0 Then ProgressSet(80)
Global $numberof = IniReadSectionNames(@ScriptDir & '\GooCal Settings\Current Entries.ini')
If Not $currentrecord Then $currentrecord = 1
$thetitle = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Title', '')
$thewhen = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'When', '')
$thewhere = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Where', '')
$thedescription = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Description', '')
GUICtrlSetData($guiTitle, $thetitle)
GUICtrlSetData($guiWhen, $thewhen)
GUICtrlSetData($guiWhere, $thewhere)
GUICtrlSetData($guiDescription, $thedescription)
GUICtrlSetState($ButtonRefresh, $GUI_ENABLE)
If $var = 0 Then ProgressSet(100)
If $currentrecord = $numberof[0] Then
  GUICtrlSetState($ButtonNext, $GUI_DISABLE)
Else
  GUICtrlSetState($ButtonNext, $GUI_ENABLE)
EndIf
If $currentrecord = 1 Then
  GUICtrlSetState($ButtonPrevious, $GUI_DISABLE)
Else
  GUICtrlSetState($ButtonPrevious, $GUI_ENABLE)
EndIf
If $var = 0 Then Sleep(1000)
If $var = 0 Then ProgressOff()
EndFunc   ;==>RetrieveData
Func GetRawData($var = 0)
If $var = 0 Then $loader = ProgressOn('Loading', 'Updating data from the cloud', 'Downloading')
$datemin = _DateAdd('D', -1, @YEAR & '/' & @MON & '/' & @MDAY)
$datemax = _DateAdd('M', +6, @YEAR & '/' & @MON & '/' & @MDAY)
If $var = 0 Then ProgressSet(15)
$urltocal = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', '')
$urltocal &= '?singleevents=true&start-max=' & StringReplace($datemax, '/', '-') & '&start-min=' & StringReplace($datemin, '/', '-') & '&sortorder=a&orderby=starttime'
If $var = 0 Then ProgressSet(35)
Global $file = _INetGetSource($urltocal)
If $var = 0 Then ProgressSet(50)
Global $entries = _StringBetween($file, '<entry>', '</entry>')
Global $count = UBound($entries)
$currentrecord = 0
If $var = 0 Then ProgressSet(60)
If $count = 0 Then
  ProgressOff()
  If $var = 0 Then MsgBox(262144, 'Data refresh', 'Could not update from the cloud.')
EndIf
EndFunc   ;==>GetRawData
Func ExtractDataThenSave($var = 0)
If $count <> '' Or $count <> 0 Then
  If $count > 0 Then FileWrite($entryamountreceived, @CRLF & $count)
  $currententries = FileOpen(@ScriptDir & '\GooCal Settings\Current Entries.ini', 10)
  FileClose($ini)
  $create = $count + 10
  Global $sort[$create][2]
  For $entryretrieval = ($count - 1) To 0 Step -1
   $ID = _StringBetween($entries[$entryretrieval], '<ID>', '</ID>')
   $tmp = StringInStr($ID[0], 'morthawt.com')
   $ID = StringTrimLeft($ID[0], ($tmp + 12))
   $title = _StringBetween($entries[$entryretrieval], '<title type=''html''>', '</title>')
   If IsArray($title) Then $title = $title[0]
   $when = _StringBetween($entries[$entryretrieval], '<summary type=''html''>When: ', '&lt;br&gt;')
   If IsArray($when) Then $when = StringReplace($when[0], '&amp;nbsp;', '')
   $when = StringReplace($when, @LF, ' ')
   $sort[$entryretrieval][0] = $ID
   $where = _StringBetween($entries[$entryretrieval], '&lt;br&gt;Where: ', '&lt;br&gt;')
   If IsArray($where) Then $where = $where[0]
   $where = StringReplace($where, @LF, ' ')

   $contents = StringSplit($when, ' ')
   Select
    Case $contents[3] = 'Jan'
     $month = '01'
    Case $contents[3] = 'Feb'
     $month = '02'
    Case $contents[3] = 'Mar'
     $month = '03'
    Case $contents[3] = 'Apr'
     $month = '04'
    Case $contents[3] = 'May'
     $month = '05'
    Case $contents[3] = 'Jun'
     $month = '06'
    Case $contents[3] = 'Jul'
     $month = '07'
    Case $contents[3] = 'Aug'
     $month = '08'
    Case $contents[3] = 'Sep'
     $month = '09'
    Case $contents[3] = 'Oct'
     $month = '10'
    Case $contents[3] = 'Nov'
     $month = '11'
    Case $contents[3] = 'Dec'
     $month = '12'
   EndSelect
   $dayofyear = _DateDiff('D', $contents[4] & '/' & $month & '/' & $contents[2], $contents[4] & '/01/01')
   $dayofyear *= -1
   If _DateIsLeapYear($contents[4]) Then
    $daysthisyear = 366
   Else
    $daysthisyear = 365
   EndIf
   $decimalpercentofyear = $dayofyear / $daysthisyear
   $sort[$entryretrieval][1] = $contents[4] + $decimalpercentofyear
   $sort[$entryretrieval][0] = $ID
   $description = _StringBetween($entries[$entryretrieval], '&lt;br /&gt;Event Description: ', '</content>')
   If IsArray($description) Then $description = $description[0]
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'ID', $ID)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Title', $title)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'When', $when)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Where', $where)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Description', $description)
   IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'YearPosition', $contents[4] + $decimalpercentofyear)
  Next
  _ArraySort($sort, 1, 0, 0, 1)
  For $a = ($count - 1) To 0 Step -1
   $cOrderTitle = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Title', '0')
   $cOrderWhen = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'When', '0')
   $cOrderWhere = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Where', '0')
   $cOrderDescription = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Description', '0')
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Title', $cOrderTitle)
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'When', $cOrderWhen)
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Where', $cOrderWhere)
   IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Description', $cOrderDescription)
  Next
  If $var = 0 Then ProgressSet(75)
EndIf
EndFunc   ;==>ExtractDataThenSave

Do you have any comments or suggestions?

Link to comment
Share on other sites

  • 1 month later...

Do you have any comments or suggestions?

This is sort of what i was looking for, but i wanted to use ical as it seams to be a little bit more universal in its implementation, meaning i can use it for systems other than GOOGLE ... not that at the moment i have any other uses, but time has a funny way of making us change things around a little.

your code seams pretty sound, although i would advise you to use global vars for any files you want to read from or write too, as then they are easily changable if you need to in the future. Its not critical, but it makes it easier to read though.

some comments in your code also make it easier to read in a few years time when you have forgotten half of what the app does :D

Comments also would have made it easier for me to read though (although it really wasn't that hard already) ... but im just being picky (as you asked for feedback and noone else gave any)

Edited by YTSJim
Link to comment
Share on other sites

  • 2 years later...

Hello Morthawt

Do you still working on this project?

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...