Skip to content

Instantly share code, notes, and snippets.

@azu
Created June 28, 2010 15:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/456001 to your computer and use it in GitHub Desktop.
Save azu/456001 to your computer and use it in GitHub Desktop.
ファイルの作成して書き込み #NILScript
// ==UserScript==
// @name new_script
// @namespace http://efcl.info/
// @description ファイルの作成→書き込み
// @author azu
// @homepage http://efcl.info/
// @twitter https://twitter.com/azu_re
// ==/UserScript==
// ファイルパスにcontentを入れたファイルを作成する。
// pathはファイル名のみだとスクリプトと同じ場所に作成する
function newFile(path , content){
if(path.indexOf("\\") == -1){
var fileNmae = "test.txt";
var path = Main.scriptDirectory + "\\"+ fileNmae;
}
// return fileStreamOperationMixin
var file = (new File(path));
// 中身があっても消える
file.update(content)
}
newFile("test.txt" , <>// ==UserScript==
// @name new_script
// @namespace http://efcl.info/
// @description
// @author azu
// @homepage http://efcl.info/
// @twitter https://twitter.com/azu_re
// ==/UserScript==
</>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment