js檢測某個時段

需求要在某個時段做某些事件,寫了個簡單的檢測函數。方便下次直接用。

  
/*
 時間範圍
 @st: start time,
 @et: end time,
*/
function timeFrame(st, et){
  st === undefined ? st = new Date().getTime() : st = Date.parse(st);
  et = Date.parse(et);
  //current time;
  var ct = new Date().getTime();

  if( ct > st && ct < et ){
    return true;
  }else{
    return false;
  }
}

console.log("現在是否 2016-12-29,16:30:00 至 2016-12-29,17:00:00 之間? is " +
  timeFrame("2016-12-29,16:30:00", "2016-12-29,17:00:00"));


  

Photoshop Scripts 筆記

近日在學習 Photoshop Scripts 做下筆記

DOWNLOAD:
http://www.adobe.com/cn/devnet/scripting.html

1:Adobe Photoshop Scripting ,Adobe Developer Connection
所有的脚本文件和实用功能

2:Adobe Introduction to Scripting ,(PDF),Adobe
这个是一些Adobe应用程序的基本代码。不错的是PS的脚本可以适用于所有的其他Adobe产品,你只需要学习应用的DOM,你就可以上路了。

3:Adobe Photoshop CS6 Scripting Guide ,Adobe
在这个PS脚本介绍指南里面,你可以学到写脚本的基本知识。

4:Adobe Photoshop JavaScript Reference ,(PDF),Adobe
这个文件描述了你可以在PS里面用到的所有的对象和他们的函数以及方法。这也是我在写脚本的时候用的最多的文件。

5:JavaScript, Mozilla Developer Network
这里面有关于一般的JavaScript函数和用法的各种问题的答案。

6:JavaScript Tools Guide, PDF,Adobe
这里面有一些关于“ExtendedScript Toolkit”的基本信息,和一些高级技巧。例如文件系统的存取,ScriptUI, XML的使用,sockets等等。

7:PS-Script
一个独立的关于PS脚本的论坛。我不能注册参与讨论(因为某些未适应系统),但是它有很多可以被发现的解决问题的答案。

8:Photoshop Scripting,Adobe Community
Adobe的PS脚本官方论坛,有一些很好的在用户使用的过程中遇到的问题的讨论。

/*
Application
================================================================
*/

app.activeDocument //正在編輯的文檔

app.activeDocument.activeLayer //正在編輯的圖層

app.activeDocument.layers //文檔→層(包括圖層、圖層組)

app.activeDocument.artLayers //文檔→圖層(不包括圖層組)
app.activeDocument.artLayers.getByName(‘xxx’)
app.activeDocument.artLayers.getByName(‘xxx’).bounds

//文檔→圖層組→圖層
app.activeDocument.layerSets.getByName(‘xxx’).artLayers.getByName(‘xxx’)

object.bounds //座標:左上(X, Y);右下(X, Y)

/*
JXS
================================================================
*/

Continue reading →