Added syncing only new files.

Added syncing only new files.

; =============================================================================
; [Project Structure]
;  -bin
;  -lib
;  -svn
;   -flash
;   -xml
;  -assets
;  -templates
;  -src
; =============================================================================
; Running Flash IDE(you don't need to open the fla document).
; in lazy mode
; win + z
; 1) main flow
; 2) fb preview
;
; Auto deploy the application for testing on a server.
; win + o
;
; Testing in IE
; win + x
;
; sync only new files
; win + n
; =============================================================================

; Setting variables
global WWW = "http://flash.isobar.com.tw/hk/project/"
global SWF_PATH = "d:\Data\project\bin\"
global SVN_PATH = "d:\Data\project\svn\flash\"

#z::
IfWinExist Adobe Flash CS5
{
	InputBox myChoice, , 1) Main Flow  2) FB Preview
	if ErrorLevel
	{
		MsgBox, What is your choice?
		return
	}

	if myChoice = 1
	{
		; Displays a standard dialog that allows the user to open files
		FileSelectFile, SelectedFile, 3
		if SelectedFile =
		{
			MsgBox, Do you select a fla file?!
			return
		}
		clipboard = %SelectedFile%
		CompileSWF()
		SyncSWF()
	}
	else if myChoice = 2
	{
		Run Flash.exe "d:\Data\project\lib\fb_as.fla"
		WinWait fb_as.fla
		WinActivate
		Send ^{ENTER}
		; waiting for Exporting SWF Movie
		WinWait, Exporting SWF Movie
		WinWaitClose, Exporting SWF Movie
		Sleep 1000
		Send ^{w}
		Send ^{w}
		; run FlashDevelop
		Run "d:\Data\project\FbShareResult.as3proj.lnk"
		IfWinExist FbShareResult - FlashDevelop
		{
			WinActivate
			Send {F5}
		}
		else
		{
			WinWait FbShareResult - FlashDevelop
			WinActivate
			Send {F5}
		}
		WinWait, Adobe Flash Player 11
		WinActivate
		;WinWaitClose, Adobe Flash Player 11
		FileCopy %SWF_PATH%fb.swf, %SVN_PATH%fb.swf, 1
		Sleep 1000
		Send ^{q}
		MsgBox done - FB Preview
	}
}
return

; Adobe Flash CS5 export swf
CompileSWF()
{
	; Separates a file name - http://www.autohotkey.com/docs/commands/SplitPath.htm
	SplitPath, clipboard, name
	; run flash
	Run, Flash.exe "%clipboard%"
	WinWait %name%
	WinActivate
	Send ^{ENTER}
	; waiting for Exporting SWF Movie
	;WinWait, ahk_class Afx:00400000:b:00010005:00000006:3C521445
	WinWait, Exporting SWF Movie
	WinWaitClose, Exporting SWF Movie
	Sleep 1000
	; close
	Send ^{w}
	Send ^{w}
}

; Sync swf file
SyncSWF()
{
	SplitPath, clipboard, name,,,name_no_ext
	swfname = %name_no_ext%.swf
	FileCopy %SWF_PATH%%swfname%, %SVN_PATH%%swfname%, 1
	;MsgBox %SWF_PATH%%swfname% %SVN_PATH%%swfname%
	MsgBox done - Main flow
}

; Testing in IE
#x::
Run, iexplore.exe
WinWait Home - APAC Comms Portal - Windows Internet Explorer
Send ^+{DEL}
Sleep 500
Send D
Sleep 500
Send ^{o}
SetKeyDelay, 0
Send %www%{ENTER}
return

; SVN auto commit
#o::
Run, "d:\Data\project\AutoCommit.bat"
return

; Copy only the source files that are newer than their counterparts
#n::
SetBatchLines, -1
FileList =
; FileSelectFolder, WhichFolder
; Loop, %WhichFolder%\*.*, , 1
; 0: Subfolders are not recursed into
Loop, %SWF_PATH%\*.swf, , 0
{
  copy_it = n
  IfNotExist, %SVN_PATH%\%A_LoopFileName%
    copy_it = y
  Else
  {
    FileGetTime, time, %SVN_PATH%\%A_LoopFileName%
    ;EnvSub, time, %A_LoopFileTimeModified%, seconds
    time -= %A_LoopFileTimeModified%, seconds
    if time < 0
      copy_it = y
  }
  if copy_it = y
  {
    FileCopy, %A_LoopFileFullPath%, %SVN_PATH%\%A_LoopFileName%, 1
    FileList = %FileList%%A_LoopFileName%`n
    if ErrorLevel
      MsgBox, Could not copy "%A_LoopFileFullPath%" to "%SVN_PATH%\%A_LoopFileName%".
  }
}
if FileList =
  MsgBox, sync all files.
else
  MsgBox, copy %FileList%
return

; =============================================================================
; [Project Structure]
;  -bin
;  -lib
;  -svn
;   -flash
;   -xml
;  -assets
;  -templates
;  -src
; =============================================================================
; Running Flash IDE(you don't need to open the fla document).
; win + z
; 1) main flow
; 2) fb preview
;
; Auto deploy the application for testing on a server.
; win + x
;
; Testing in IE
; win + o
; =============================================================================

; Setting variables
global WWW = "http://flash.isobar.com.tw/hk/project/"
global SWF_PATH = "d:\Data\project\bin\"
global SVN_PATH = "d:\Data\project\svn\flash\"

#z::
IfWinExist Adobe Flash CS5
{
	InputBox myChoice, , 1) Main Flow  2) FB Preview
	if ErrorLevel
	{
		MsgBox, What is your choice?
		return
	}

	if myChoice = 1
	{
		; Displays a standard dialog that allows the user to open files
		FileSelectFile, SelectedFile, 3
		if SelectedFile =
		{
			MsgBox, Do you select a fla file?!
			return
		}
		clipboard = %SelectedFile%
		CompileSWF()
		SyncSWF()
	}
	else if myChoice = 2
	{
		Run Flash.exe "d:\Data\project\lib\fb_as.fla"
		WinWait fb_as.fla
		WinActivate
		Send ^{ENTER}
		; waiting for Exporting SWF Movie
		WinWait, Exporting SWF Movie
		WinWaitClose, Exporting SWF Movie
		Sleep 1000
		Send ^{w}
		Send ^{w}
		; run FlashDevelop
		Run "d:\Data\project\FbShareResult.as3proj.lnk"
		IfWinExist FbShareResult - FlashDevelop
		{
			WinActivate
			Send {F5}
		}
		else
		{
			WinWait FbShareResult - FlashDevelop
			WinActivate
			Send {F5}
		}
		WinWait, Adobe Flash Player 11
		WinActivate
		;WinWaitClose, Adobe Flash Player 11
		FileCopy %SWF_PATH%fb.swf, %SVN_PATH%fb.swf, 1
		Sleep 1000
		Send ^{q}
		MsgBox done - FB Preview
	}
}
return

; Adobe Flash CS5 export swf
CompileSWF()
{
	; Separates a file name - http://www.autohotkey.com/docs/commands/SplitPath.htm
	SplitPath, clipboard, name
	; run flash
	Run, Flash.exe "%clipboard%"
	WinWait %name%
	WinActivate
	Send ^{ENTER}
	; waiting for Exporting SWF Movie
	;WinWait, ahk_class Afx:00400000:b:00010005:00000006:3C521445
	WinWait, Exporting SWF Movie
	WinWaitClose, Exporting SWF Movie
	Sleep 1000
	; close
	Send ^{w}
	Send ^{w}
}

; Sync swf file
SyncSWF()
{
	SplitPath, clipboard, name,,,name_no_ext
	swfname = %name_no_ext%.swf
	FileCopy %SWF_PATH%%swfname%, %SVN_PATH%%swfname%, 1
	;MsgBox %SWF_PATH%%swfname% %SVN_PATH%%swfname%
	MsgBox done - Main flow
}

; Testing in IE
#o::
Run, iexplore.exe
WinWait Home - APAC Comms Portal - Windows Internet Explorer
Send ^+{DEL}
Sleep 500
Send D
Sleep 500
Send ^{o}
SetKeyDelay, 0
Send %www%{ENTER}
return

; SVN auto commit
#x::
Run, "d:\Data\project\AutoCommit.bat"
return


[hotkey] correctly map F12

[hotkey] correctly map F12

Maps F12 -> F12 because kill yourself

; Autohotkey configuration file
; AHK Version v.1.1.32.00
; Franklin Chou (franklin.chou@nelsonmullins.com)
; 22 Mar. 2020
; Tested to work on Lenovo X1 Yoga, Gen. 4

#SingleInstance Force
#Persistent

GLOBAL_DEBUG_MODE := 0
Return

CapsLock::Ctrl
LCtrl::Return
;LCtrl::CapsLock

; DEBUG TOOLS -----------------------------------------------------------------

#c::
  If(GLOBAL_DEBUG_MODE > 0) {
    ; WinGetTitle, title, A
    WinGetClass, title, A
    MsgBox %title%
  }
Return

f12::
  If(GLOBAL_DEBUG_MODE > 0) {
    Reload
  }
Return

#'::
  If(GLOBAL_DEBUG_MODE > 0) {
    WinGet, windows, List
    Loop %windows% {
      id := windows%A_Index%
      WinGetTitle wt, ahk_id %id%
      r .= wt . "`n"
    }
    MsgBox %r%
    r := ""
  }
Return

; TIMEKEEPER ------------------------------------------------------------------

; Shift focus to the timekeeper app
#!e::
  timekeeper_app := WinExist("ahk_class WindowsForms10.Window.8.app.0.262fb3d")
  ;MsgBox %timekeeper_app%
  If(timekeeper_app > 0) {
    WinActivate, ahk_id %timekeeper_app%
  } Else {
    Run, DTE.exe, C:\Program Files (x86)\DTEAxiom
  }
Return

; Start the timer on the selected item in the daily view
#IfWinActive ahk_class WindowsForms10.Window.8.app.0.262fb3d
  >+s::
    WinGetActiveTitle, active_title
    match_result := RegExMatch(active_title, "^Entries for")
    ; each item in the dropdown is approximately 25 pixels
    ; so item 4 (Start Timer) is 100 pixels down from the context menu
    drop_down := 100
    If(match_result > 0) {
      WinMove, 100, 100
      MouseMove, 100, 280
      Send {RButton}
      Sleep, 10 ; need to sleep to allow submenu time to come up
      MouseMove, 170, 300 + drop_down
      Send {LButton}
    }
Return

; WORD/OUTLOOK ----------------------------------------------------------------

; Let the print screen key open the application options key (for spell check)
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class rctrl_renwnd32")
  PrintScreen::AppsKey
Return

; WORD ONLY -------------------------------------------------------------------

; Cycle through types of markup
#If WinActive("ahk_class OpusApp")
  >+m::
    Send !r
    Sleep, 10
    Send td
    Send {Down}
    Send {Enter}
Return

; This ridiculous keymapping is thanks to Lenovo keyboard manager
; which maps F12 to some bloatware keyboard manager utility
#If WinActive("ahk_class OpusApp")
  F12::
    Send {F12}
Return

; Autohotkey configuration file
; AHK Version v.1.1.32.00
; Franklin Chou (franklin.chou@nelsonmullins.com)
; 22 Mar. 2020
; Tested to work on Lenovo X1 Yoga, Gen. 4

#SingleInstance Force
#Persistent

GLOBAL_DEBUG_MODE := 0
Return

CapsLock::Ctrl
LCtrl::Return
;LCtrl::CapsLock

; DEBUG TOOLS -----------------------------------------------------------------

#c::
  If(GLOBAL_DEBUG_MODE > 0) {
    ; WinGetTitle, title, A
    WinGetClass, title, A
    MsgBox %title%
  }
Return

f12::
  If(GLOBAL_DEBUG_MODE > 0) {
    Reload
  }
Return

#'::
  If(GLOBAL_DEBUG_MODE > 0) {
    WinGet windows, List
    Loop %windows% {
      id := windows%A_Index%
      WinGetTitle wt, ahk_id %id%
      r .= wt . "`n"
    }
    MsgBox %r%
  }
Return

; TIMEKEEPER ------------------------------------------------------------------

; Shift focus to the timekeeper app
#!e::
  timekeeper_app := WinExist("ahk_class WindowsForms10.Window.8.app.0.262fb3d")
  ;MsgBox %timekeeper_app%
  If(timekeeper_app > 0) {
    WinActivate, ahk_id %timekeeper_app%
  } Else {
    Run, DTE.exe, C:\Program Files (x86)\DTEAxiom
  }
Return

; Start the timer on the selected item in the daily view
#IfWinActive ahk_class WindowsForms10.Window.8.app.0.262fb3d
  >+s::
    WinGetActiveTitle, active_title
    match_result := RegExMatch(active_title, "^Entries for")
    ; each item in the dropdown is approximately 25 pixels
    ; so item 4 (Start Timer) is 100 pixels down from the context menu
    drop_down := 100
    If(match_result > 0) {
      WinMove, 100, 100
      MouseMove, 100, 280
      Send {RButton}
      Sleep, 10 ; need to sleep to allow submenu time to come up
      MouseMove, 170, 300 + drop_down
      Send {LButton}
    }
Return

; WORD/OUTLOOK ----------------------------------------------------------------
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class rctrl_renwnd32")
  PrintScreen::AppsKey
Return

; WORD ONLY -------------------------------------------------------------------
#If WinActive("ahk_class OpusApp")
  >+M::  ; Cycle through types of markup
    Send !r
    Sleep, 10
    Send td
    Send {Down}
    Send {Enter}
Return