Pages

Saturday, August 25, 2018

Daily UpdateBacklog au3

Daily UpdateBacklog au3


Task reminders in morning or evening dont really work. Especially when quite busy last thing and opening explorer, locking a file, opening excel takes a few minutes. So. Automate the open folder, get svn lock and open file part and pop all up as a reminder. Hudson daily task and AutoIt script.

Prompt user, svn update, get lock, open .xls file, commit and release lock (or timeout and release lock) handle lock fail or user not present run from Hudson or other regular cron tool.



;http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html
;http://www.autoitscript.com/autoit3/docs/libfunctions/_IECreate.htm
;http://stackoverflow.com/questions/9667957/automation-of-right-clicking-of-file-in-windows-explorer


#include <GUIListView.au3>
#include  <Excel.au3>

$Title = "UPDATE BACKLOG"
$Path = "C:SVNDocsPlanningXXX"
$File = "C:SVNDocsPlanningXXXSprint36.xls"

$TortoisePath = "c:Program FilesTortoiseSVN inTortoiseProc.exe"
;http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html
; TODO: change all to /closeonend:1 when all are working
;/closeonend:1 auto close if no errors

Local $iSvnPid = Run($TortoisePath & " /closeonend:1 /command:update /path:" & $Path)
ProcessWaitClose($iSvnPid)
$x = MsgBox(0,$Title & ": svn update done","svnpid:"&$iSvnPid&" svn update done",5)

;http://www.autoitscript.com/autoit3/docs/libfunctions/_IECreate.htm
;#include
;Local $oIE = _IECreate("www.autoitscript.com")

$x = MsgBox(33,$Title & ": Try and Lock Backlog?",$File&" Try and Lock Backlog?",1800)
;$x = MsgBox(0,$Title & ": Debug","Debug answer = " & $x,900)
; $x = 1 okay $x = 2 cancel

If $x = 1 Then
  ;Hmpfh. the lock command doesnt take logmsg
  Local $iSvnPid = Run($TortoisePath & " /closeonend:0 /command:lock /logmsg:""update jco integration tasks"" /path:" & $File)
  ProcessWaitClose($iSvnPid)
  $x1 = MsgBox(33,$Title & ": Locked?",$File&" Did you lock it?")

  ;http://stackoverflow.com/questions/9667957/automation-of-right-clicking-of-file-in-windows-explorer
  ;Local $hList = ControlGetHandle("[CLASS:CabinetWClass]", "", "[CLASS:SysListView32; INSTANCE:1]")
  ;Local $aClient = WinGetPos($hList)
  ;Local $aPos = _GUICtrlListView_GetItemPosition($hList, _GUICtrlListView_GetSelectedIndices($hList))
  ;MouseClick("Right", $aClient[0] + $aPos[0] + 4, $aClient[1] + $aPos[1] + 4)
  
  ;MouseClick("Right", "Optical_SW_Sprint_36.xls")

  If $x1 = 1 Then

    ;pull up explorer window for commit or if there is trouble
    Local $iPid = Run("C:WINDOWSEXPLORER.EXE /n,/e," & $Path)
    ProcessWait($iPid)
    MsgBox(0,$Title & ": EXPLORER","pid:"&$iPid,5)
    Sleep(3000)
  
    $excel_file = _ExcelBookOpen($File)

    $x2 = MsgBox(33,$Title & ": Commit and unlock Backlog","Now edit backlog. When finished commit and unlock Backlog. Finished? ")

    If $x2 = 1 Then
      ; commit and release lock
      Local $iSvnPid = Run($TortoisePath & " /closeonend:0 /command:commit /logmsg:""update jco integration tasks"" /path:" & $File)
      ProcessWait($iSvnPid)
    EndIf
   
  EndIf

  ; unlock in case the commit didnt unlock
  Sleep(30000)
  Local $iSvnPid = Run($TortoisePath & " /closeonend:1 /command:unlock /path:" & $File)
  ProcessWait($iSvnPid)

  ; close explorer
  ProcessClose($iPid)

EndIf

Exit

visit link download

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.