Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{hidden}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE{hidden}
{sub-section:description|text=}{sub-section}\\ 

{table:class=servoy sReturnTypes}{tr:style=height: 30px;}{th}Return Types{th}{tr}{tr}{td}{span:class=sWordList}[JSFile]{span}{td}{tr}{table}\\ 

{table:class=servoy sSummery}{colgroup}{column:width=80px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[JSFile]{td}{td}[#convertToJSFile]\(file)
Returns a JSFile instance corresponding to an alternative representation of a file (for example a string).{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#copyFile]\(sourceFile, destinationFile)
Copies the sourcefile to the destination file.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#copyFolder]\(sourceFolder, destinationFolder)
Copies the sourcefolder to the destination folder, recursively.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#createFile]\(targetFile)
Creates a JSFile instance.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#createFolder]\(targetFolder)
Creates a folder on disk.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#createTempFile]\(filePrefix, fileSuffix)
Creates a temporary file on disk.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteFile]\(targetFile)
Removes a file from disk.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#deleteFolder]\(targetFolder, showWarning)
Deletes a folder from disk recursively.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#getDesktopFolder]\()
Returns a JSFile instance that corresponds to the Desktop folder of the currently logged in user.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]\[]{td}{td}[#getDiskList]\()
Returns an Array of JSFile instances correponding to the file system root folders.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getFileSize]\(targetFile)
Returns the size of the specified file.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]\[]{td}{td}[#getFolderContents]\(targetFolder, fileFilter, fileOption(1=files,2=dirs), visibleOption(1=visible,2=nonvisible), lockedOption(1=locked,2=nonlocked))
Returns an array of JSFile instances corresponding to content of the specified folder.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#getHomeDirectory]\()
Returns a JSFile instance corresponding to the home folder of the logged in used.{td}{tr}{tbody}{tbody}{tr}{td}[Date]{td}{td}[#getModificationDate]\(targetFile)
Returns the modification date of a file.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#moveFile]\(sourceFile, destinationFile)
Moves the file from the source to the destination place.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#readFile]\(file, size)
Reads all or part of the content from a binary file.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#readTXTFile]\(file, charsetname)
Read all content from a text file.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#showDirectorySelectDialog]\(directory suggestion, dialog title text)
Shows a directory selector dialog.{td}{tr}{tbody}{tbody}{tr}{td}Object{td}{td}[#showFileOpenDialog]\(selectionMode(0=both,1=Files,2=Dirs), startDirectory(null=default/previous), multiselect(true/false), filterarray, callbackmethod, dialog title text)
Shows a file open dialog.{td}{tr}{tbody}{tbody}{tr}{td}[JSFile]{td}{td}[#showFileSaveDialog]\(fileName/dir suggestion, dialog title text)
Shows a file save dialog.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#writeFile]\(file, binary_data)
Writes data into a binary file.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#writeTXTFile]\(file, text_data, charsetname)
Writes data into a text file.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#writeXMLFile]\(file, xml_data)
Writes data into an XML file.{td}{tr}{tbody}{table}\\ 

{table:class=servoy sDetail}{colgroup}{column:width=100%}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473}{tr:id=name}{td}h6.convertToJSFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}convertToJSFile{span}{span:id=iets|style=float: left;}\(file){span}{td}{tr}{tr:id=des}{td}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_des|text=|trigger=button}{sub-section}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_des|trigger=none|class=sIndent}Returns a JSFile instance corresponding to an alternative representation of a file (for example a string).{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_prs|trigger=none}file
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_ret|text=|trigger=button}{sub-section}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_see|text=|trigger=button}{sub-section}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_see|text=|trigger=button}{sub-section}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_sam|text=|trigger=button}{sub-section}{sub-section:CA8F91E5BE4BF2B6-08D836B6-40764F01-9E85BE43-EBF473457621767C78FE0473_sam|class=sIndent|trigger=none}{code:language=javascript}
var f = plugins.file.convertToJSFile("story.txt");
if (f.canRead())
	application.output("File can be read.");
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E}{tr:id=name}{td}h6.copyFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}copyFile{span}{span:id=iets|style=float: left;}\(sourceFile, destinationFile){span}{td}{tr}{tr:id=des}{td}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_des|text=|trigger=button}{sub-section}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_des|trigger=none|class=sIndent}Copies the sourcefile to the destination file. Returns true if the copy succeeds, false if any error occurs.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_prs|trigger=none}sourceFile
destinationFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_ret|text=|trigger=button}{sub-section}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_see|text=|trigger=button}{sub-section}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_see|text=|trigger=button}{sub-section}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_sam|text=|trigger=button}{sub-section}{sub-section:B41D5E5E49FE11CF-51CA9A80-40294A9C-B175994F-7E0BD4A0B99C51F95F35EE7E_sam|class=sIndent|trigger=none}{code:language=javascript}
// Copy based on file names.
if (!plugins.file.copyFile("story.txt", "story.txt.copy"))
	application.output("Copy failed.");
// Copy based on JSFile instances.
var f = plugins.file.createFile("story.txt");
var fcopy = plugins.file.createFile("story.txt.copy2");
if (!plugins.file.copyFile(f, fcopy))
	application.output("Copy failed.");
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629}{tr:id=name}{td}h6.copyFolder{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}copyFolder{span}{span:id=iets|style=float: left;}\(sourceFolder, destinationFolder){span}{td}{tr}{tr:id=des}{td}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_des|text=|trigger=button}{sub-section}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_des|trigger=none|class=sIndent}Copies the sourcefolder to the destination folder, recursively. Returns true if the copy succeeds, false if any error occurs.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_prs|trigger=none}sourceFolder
destinationFolder
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_ret|text=|trigger=button}{sub-section}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_see|text=|trigger=button}{sub-section}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_see|text=|trigger=button}{sub-section}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_sam|text=|trigger=button}{sub-section}{sub-section:62ADEEE1C94CE97F-4D3ABACF-4998467B-A94EBA04-42F544E2C347845E3912C629_sam|class=sIndent|trigger=none}{code:language=javascript}
// Copy folder based on names.
if (!plugins.file.copyFolder("stories", "stories_copy"))
	application.output("Folder copy failed.");
// Copy folder based on JSFile instances.
var d = plugins.file.createFile("stories");
var dcopy = plugins.file.createFile("stories_copy_2");
if (!plugins.file.copyFolder(d, dcopy))
	application.output("Folder copy failed.");
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A}{tr:id=name}{td}h6.createFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}createFile{span}{span:id=iets|style=float: left;}\(targetFile){span}{td}{tr}{tr:id=des}{td}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_des|text=|trigger=button}{sub-section}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_des|trigger=none|class=sIndent}Creates a JSFile instance. Does not create the file on disk.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_prs|trigger=none}targetFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_ret|text=|trigger=button}{sub-section}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_see|text=|trigger=button}{sub-section}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_see|text=|trigger=button}{sub-section}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_sam|text=|trigger=button}{sub-section}{sub-section:973BC3AE2BEAD824-D0F9AD3D-4D924E82-A1F29EF2-78B75E75FFBE91A1DC7F2A7A_sam|class=sIndent|trigger=none}{code:language=javascript}
// Create the JSFile instance based on the file name.
var f = plugins.file.createFile("newfile.txt");
// Create the file on disk.
if (!f.createNewFile())
	application.output("The file could not be created.");
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2}{tr:id=name}{td}h6.createFolder{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}createFolder{span}{span:id=iets|style=float: left;}\(targetFolder){span}{td}{tr}{tr:id=des}{td}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_des|text=|trigger=button}{sub-section}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_des|trigger=none|class=sIndent}Creates a folder on disk. Returns true if the folder is successfully created, false if any error occurs.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_prs|trigger=none}targetFolder
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_ret|text=|trigger=button}{sub-section}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_see|text=|trigger=button}{sub-section}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_see|text=|trigger=button}{sub-section}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_sam|text=|trigger=button}{sub-section}{sub-section:49F45B2748356DDB-992E0F78-4B794C1E-B4E4ABD0-55F1331630FEFE04BC05FAD2_sam|class=sIndent|trigger=none}{code:language=javascript}
var d = plugins.file.convertToJSFile("newfolder");
if (!plugins.file.createFolder(d))
	application.output("Folder could not be created.");
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F}{tr:id=name}{td}h6.createTempFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}createTempFile{span}{span:id=iets|style=float: left;}\(filePrefix, fileSuffix){span}{td}{tr}{tr:id=des}{td}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_des|text=|trigger=button}{sub-section}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_des|trigger=none|class=sIndent}Creates a temporary file on disk. A prefix and an extension are specified and they will be part of the file name.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_prs|trigger=none}filePrefix
fileSuffix
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_ret|text=|trigger=button}{sub-section}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_see|text=|trigger=button}{sub-section}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_see|text=|trigger=button}{sub-section}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_sam|text=|trigger=button}{sub-section}{sub-section:615DEBEC1770F15A-6A4E3CE2-45724FF5-80E3B97C-7B50868AE82994AE1400B02F_sam|class=sIndent|trigger=none}{code:language=javascript}
var tempFile = plugins.file.createTempFile('myfile','.txt');
application.output('Temporary file created as: ' + tempFile.getAbsolutePath());
plugins.file.writeTXTFile(tempFile, 'abcdefg');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD}{tr:id=name}{td}h6.deleteFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}deleteFile{span}{span:id=iets|style=float: left;}\(targetFile){span}{td}{tr}{tr:id=des}{td}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_des|text=|trigger=button}{sub-section}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_des|trigger=none|class=sIndent}Removes a file from disk. Returns true on success, false otherwise.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_prs|trigger=none}targetFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_ret|text=|trigger=button}{sub-section}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_see|text=|trigger=button}{sub-section}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_see|text=|trigger=button}{sub-section}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_sam|text=|trigger=button}{sub-section}{sub-section:1F1C3668EBC40218-FF474B8A-40FA404B-B1EEBBBC-3E4AFE11365EF05D3E9962FD_sam|class=sIndent|trigger=none}{code:language=javascript}
if (plugins.file.deleteFile('story.txt'))
	application.output('File deleted.');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945}{tr:id=name}{td}h6.deleteFolder{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}deleteFolder{span}{span:id=iets|style=float: left;}\(targetFolder, showWarning){span}{td}{tr}{tr:id=des}{td}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_des|text=|trigger=button}{sub-section}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_des|trigger=none|class=sIndent}Deletes a folder from disk recursively. Returns true on success, false otherwise. If the second parameter is set to true, then a warning will be issued to the user before actually removing the folder.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_prs|trigger=none}targetFolder
showWarning
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_ret|text=|trigger=button}{sub-section}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_see|text=|trigger=button}{sub-section}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_see|text=|trigger=button}{sub-section}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_sam|text=|trigger=button}{sub-section}{sub-section:C358F2674D3F644B-A64222E3-43204453-A8C29503-442D275E2BBAC427E0AC9945_sam|class=sIndent|trigger=none}{code:language=javascript}
if (plugins.file.deleteFolder('stories', true))
	application.output('Folder deleted.');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A}{tr:id=name}{td}h6.getDesktopFolder{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}getDesktopFolder{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_des|text=|trigger=button}{sub-section}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_des|trigger=none|class=sIndent}Returns a JSFile instance that corresponds to the Desktop folder of the currently logged in user.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_ret|text=|trigger=button}{sub-section}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_see|text=|trigger=button}{sub-section}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_see|text=|trigger=button}{sub-section}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_sam|text=|trigger=button}{sub-section}{sub-section:C1D2D7EFCA118F39-DD27077C-4E7E4897-A25FB87D-DC034E24FAA0D2008A37A60A_sam|class=sIndent|trigger=none}{code:language=javascript}
var d = plugins.file.getDesktopFolder();
application.output('desktop folder is: ' + d.getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B}{tr:id=name}{td}h6.getDiskList{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getDiskList{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_des|text=|trigger=button}{sub-section}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_des|trigger=none|class=sIndent}Returns an Array of JSFile instances correponding to the file system root folders.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_ret|text=|trigger=button}{sub-section}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_ret|trigger=none|class=sIndent}[JSFile]\[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_see|text=|trigger=button}{sub-section}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_see|text=|trigger=button}{sub-section}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_sam|text=|trigger=button}{sub-section}{sub-section:5C419307FD1F844B-3CB14349-469D49E0-9514A498-78C72393534A9DF043115A8B_sam|class=sIndent|trigger=none}{code:language=javascript}
var roots = plugins.file.getDiskList();
for (var i = 0; i < roots.length; i++)
	application.output(roots[i].getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D}{tr:id=name}{td}h6.getFileSize{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getFileSize{span}{span:id=iets|style=float: left;}\(targetFile){span}{td}{tr}{tr:id=des}{td}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_des|text=|trigger=button}{sub-section}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_des|trigger=none|class=sIndent}Returns the size of the specified file.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_prs|trigger=none}targetFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_ret|text=|trigger=button}{sub-section}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_ret|trigger=none|class=sIndent}[Number]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_see|text=|trigger=button}{sub-section}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_see|text=|trigger=button}{sub-section}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_sam|text=|trigger=button}{sub-section}{sub-section:426108818BCD441F-DE87C445-47C34F14-A48B8117-9CDC304761C35C6034605B0D_sam|class=sIndent|trigger=none}{code:language=javascript}
var f = plugins.file.convertToJSFile('story.txt');
application.output('file size: ' + plugins.file.getFileSize(f));
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944}{tr:id=name}{td}h6.getFolderContents{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getFolderContents{span}{span:id=iets|style=float: left;}\(targetFolder, fileFilter, fileOption(1=files,2=dirs), visibleOption(1=visible,2=nonvisible), lockedOption(1=locked,2=nonlocked)){span}{td}{tr}{tr:id=des}{td}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_des|text=|trigger=button}{sub-section}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_des|trigger=none|class=sIndent}Returns an array of JSFile instances corresponding to content of the specified folder. The content can be filtered by optional name filter(s), by type, by visibility and by lock status.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_prs|trigger=none}targetFolder
\[fileFilter\]
\[fileOption(1=files,2=dirs)\]
\[visibleOption(1=visible,2=nonvisible)\]
\[lockedOption(1=locked,2=nonlocked)\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_ret|text=|trigger=button}{sub-section}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_ret|trigger=none|class=sIndent}[JSFile]\[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_see|text=|trigger=button}{sub-section}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_see|text=|trigger=button}{sub-section}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_sam|text=|trigger=button}{sub-section}{sub-section:520339A245DFF727-BA6D061F-43804E29-8660B900-51E856F9C48401E98ADB1944_sam|class=sIndent|trigger=none}{code:language=javascript}
var files = plugins.file.getFolderContents('stories', '.txt');
for (var i=0; i<files.length; i++)
	application.output(files[i].getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31}{tr:id=name}{td}h6.getHomeDirectory{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}getHomeDirectory{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_des|text=|trigger=button}{sub-section}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_des|trigger=none|class=sIndent}Returns a JSFile instance corresponding to the home folder of the logged in used.{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=prs}{td}*Parameters*\\{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_prs|trigger=none}{sub-section}{div}{td}{tr}{builder-show}{tr:id=ret}{td}*Returns*\\{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_ret|text=|trigger=button}{sub-section}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_see|text=|trigger=button}{sub-section}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_see|text=|trigger=button}{sub-section}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_sam|text=|trigger=button}{sub-section}{sub-section:3E246E446FF76219-1854A9F3-48904DF9-8067A59F-E1F404C0873EEADCB960AB31_sam|class=sIndent|trigger=none}{code:language=javascript}
var d = plugins.file.getHomeDirectory();
application.output('home folder: ' + d.getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517}{tr:id=name}{td}h6.getModificationDate{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Date]{span}{span:id=iets|style=float: left; font-weight: bold;}getModificationDate{span}{span:id=iets|style=float: left;}\(targetFile){span}{td}{tr}{tr:id=des}{td}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_des|text=|trigger=button}{sub-section}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_des|trigger=none|class=sIndent}Returns the modification date of a file.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_prs|trigger=none}targetFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_ret|text=|trigger=button}{sub-section}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_ret|trigger=none|class=sIndent}[Date]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_see|text=|trigger=button}{sub-section}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_see|text=|trigger=button}{sub-section}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_sam|text=|trigger=button}{sub-section}{sub-section:4F5ECCEE8AD925EE-713B45C8-48334D50-AA7F874D-E35A42AD156B5EB301404517_sam|class=sIndent|trigger=none}{code:language=javascript}
var f = plugins.file.convertToJSFile('story.txt');
application.output('last changed: ' + plugins.file.getModificationDate(f));
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D}{tr:id=name}{td}h6.moveFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}moveFile{span}{span:id=iets|style=float: left;}\(sourceFile, destinationFile){span}{td}{tr}{tr:id=des}{td}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_des|text=|trigger=button}{sub-section}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_des|trigger=none|class=sIndent}Moves the file from the source to the destination place. Returns true on success, false otherwise.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_prs|trigger=none}sourceFile
destinationFile
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_ret|text=|trigger=button}{sub-section}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_see|text=|trigger=button}{sub-section}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_see|text=|trigger=button}{sub-section}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_sam|text=|trigger=button}{sub-section}{sub-section:758DE969BAD81605-4940079B-463E40CD-B4C7B141-6300AD52AE716BB05133C24D_sam|class=sIndent|trigger=none}{code:language=javascript}
// Move file based on names.
if (!plugins.file.moveFile('story.txt','story.txt.new'))
	application.output('File move failed.');
// Move file based on JSFile instances.
var f = plugins.file.convertToJSFile('story.txt.new');
var fmoved = plugins.file.convertToJSFile('story.txt');
if (!plugins.file.moveFile(f, fmoved))
	application.output('File move back failed.');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7}{tr:id=name}{td}h6.readFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}byte[]{span}{span:id=iets|style=float: left; font-weight: bold;}readFile{span}{span:id=iets|style=float: left;}\(file, size){span}{td}{tr}{tr:id=des}{td}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_des|text=|trigger=button}{sub-section}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_des|trigger=none|class=sIndent}Reads all or part of the content from a binary file. If a file name is not specified, then a file selection dialog pops up for selecting a file. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_prs|trigger=none}\[file\]
\[size\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_ret|text=|trigger=button}{sub-section}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_ret|trigger=none|class=sIndent}byte[]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_see|text=|trigger=button}{sub-section}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_see|text=|trigger=button}{sub-section}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_sam|text=|trigger=button}{sub-section}{sub-section:AEB4E86A76D19F73-21246C52-4A0A4B30-B8918538-F0FD79305B80596BDB056BC7_sam|class=sIndent|trigger=none}{code:language=javascript}
// Read all content from the file.
var bytes = plugins.file.readFile('big.jpg');
application.output('file size: ' + bytes.length);
// Read only the first 1KB from the file.
var bytesPartial = plugins.file.readFile('big.jpg', 1024);
application.output('partial file size: ' + bytesPartial.length);
// Read all content from a file selected from the file open dialog.
var bytesUnknownFile = plugins.file.readFile();
application.output('unknown file size: ' + bytesUnknownFile.length);
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561}{tr:id=name}{td}h6.readTXTFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}readTXTFile{span}{span:id=iets|style=float: left;}\(file, charsetname){span}{td}{tr}{tr:id=des}{td}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_des|text=|trigger=button}{sub-section}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_des|trigger=none|class=sIndent}Read all content from a text file. If a file name is not specified, then a file selection dialog pops up for selecting a file. The encoding can be also specified. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_prs|trigger=none}\[file\]
\[charsetname\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_ret|text=|trigger=button}{sub-section}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_ret|trigger=none|class=sIndent}[String]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_see|text=|trigger=button}{sub-section}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_see|text=|trigger=button}{sub-section}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_sam|text=|trigger=button}{sub-section}{sub-section:8004A5AC09A862B6-B8B723D8-451D42BB-888C8F20-831ADC433A9E20B7F2046561_sam|class=sIndent|trigger=none}{code:language=javascript}
// Read content from a known text file.
var txt = plugins.file.readTXTFile('story.txt');
application.output(txt);
// Read content from a text file selected from the file open dialog.
var txtUnknown = plugins.file.readTXTFile();
application.output(txtUnknown);
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B}{tr:id=name}{td}h6.showDirectorySelectDialog{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}showDirectorySelectDialog{span}{span:id=iets|style=float: left;}\(directory suggestion, dialog title text){span}{td}{tr}{tr:id=des}{td}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_des|text=|trigger=button}{sub-section}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_des|trigger=none|class=sIndent}Shows a directory selector dialog.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_prs|trigger=none}\[directory suggestion\]
\[dialog title text\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_ret|text=|trigger=button}{sub-section}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_see|text=|trigger=button}{sub-section}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_see|text=|trigger=button}{sub-section}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_sam|text=|trigger=button}{sub-section}{sub-section:1B95BE1DABBB2B49-EBE8EC44-41D7437B-BDDAA3A7-8F9B9DD183FC70CC584F823B_sam|class=sIndent|trigger=none}{code:language=javascript}
var dir = plugins.file.showDirectorySelectDialog();
application.output("you've selected folder: " + dir.getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32}{tr:id=name}{td}h6.showFileOpenDialog{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}Object{span}{span:id=iets|style=float: left; font-weight: bold;}showFileOpenDialog{span}{span:id=iets|style=float: left;}\(selectionMode(0=both,1=Files,2=Dirs), startDirectory(null=default/previous), multiselect(true/false), filterarray, callbackmethod, dialog title text){span}{td}{tr}{tr:id=des}{td}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_des|text=|trigger=button}{sub-section}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_des|trigger=none|class=sIndent}Shows a file open dialog. Filters can be applied on what type of files can be selected. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_prs|trigger=none}\[selectionMode(0=both,1=Files,2=Dirs)\]
\[startDirectory(null=default/previous)\]
\[multiselect(true/false)\]
\[filterarray\]
\[callbackmethod\]
\[dialog title text\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_ret|text=|trigger=button}{sub-section}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_ret|trigger=none|class=sIndent}Object{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_see|text=|trigger=button}{sub-section}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_see|text=|trigger=button}{sub-section}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_sam|text=|trigger=button}{sub-section}{sub-section:660051AB07DF39F4-D57F2D38-41454E05-84D0A478-FD6715829DC8B840DF997E32_sam|class=sIndent|trigger=none}{code:language=javascript}
// This selects only files ('1'), previous dir must be used ('null'), no multiselect ('false') and
// the filter "JPG and GIF" should be used: ('new Array("JPG and GIF","jpg","gif")').
var file = plugins.file.showFileOpenDialog(1, null, false, new Array("JPG and GIF","jpg","gif"));
application.output("you've selected file: " + file.getAbsolutePath()); + file.getAbsolutePath());
//for the web you have to give a callback function that has a JSFile array as its first argument (also works in smart), other options can be set but are not used in the webclient (yet)
var file = plugins.file.showFileOpenDialog(myCallbackMethod)
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3}{tr:id=name}{td}h6.showFileSaveDialog{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[JSFile]{span}{span:id=iets|style=float: left; font-weight: bold;}showFileSaveDialog{span}{span:id=iets|style=float: left;}\(fileName/dir suggestion, dialog title text){span}{td}{tr}{tr:id=des}{td}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_des|text=|trigger=button}{sub-section}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_des|trigger=none|class=sIndent}Shows a file save dialog.{sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_prs|trigger=none}\[fileName/dir suggestion\]
\[dialog title text\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_ret|text=|trigger=button}{sub-section}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_ret|trigger=none|class=sIndent}[JSFile]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_see|text=|trigger=button}{sub-section}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_see|text=|trigger=button}{sub-section}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_sam|text=|trigger=button}{sub-section}{sub-section:6A5B07E966673534-7FA5B8CE-401A41BA-A5FBA51C-3B348447B90DE04F221845C3_sam|class=sIndent|trigger=none}{code:language=javascript}
var file = plugins.file.showFileSaveDialog();
application.output("you've selected file: " + file.getAbsolutePath());
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138}{tr:id=name}{td}h6.writeFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}writeFile{span}{span:id=iets|style=float: left;}\(file, binary_data){span}{td}{tr}{tr:id=des}{td}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_des|text=|trigger=button}{sub-section}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_des|trigger=none|class=sIndent}Writes data into a binary file. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_prs|trigger=none}file
binary_data
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_ret|text=|trigger=button}{sub-section}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_see|text=|trigger=button}{sub-section}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_see|text=|trigger=button}{sub-section}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_sam|text=|trigger=button}{sub-section}{sub-section:DFD1ED4DD3D75521-1A546CCC-478145F4-ADCAAA1C-DA16BCBFE8DC293B01255138_sam|class=sIndent|trigger=none}{code:language=javascript}
var bytes = new Array();
for (var i=0; i<1024; i++)
	bytes[i] = i % 100;
var f = plugins.file.convertToJSFile('bin.dat');
if (!plugins.file.writeFile(f, bytes))
	application.output('Failed to write the file.');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2}{tr:id=name}{td}h6.writeTXTFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}writeTXTFile{span}{span:id=iets|style=float: left;}\(file, text_data, charsetname){span}{td}{tr}{tr:id=des}{td}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_des|text=|trigger=button}{sub-section}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_des|trigger=none|class=sIndent}Writes data into a text file. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_prs|trigger=none}file
text_data
\[charsetname\]
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_ret|text=|trigger=button}{sub-section}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_see|text=|trigger=button}{sub-section}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_see|text=|trigger=button}{sub-section}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_sam|text=|trigger=button}{sub-section}{sub-section:A7EAF0E54948A294-BC488B83-4E5042D1-A140A9DE-457526449EFE8F258AD2BED2_sam|class=sIndent|trigger=none}{code:language=javascript}
var fileNameSuggestion = 'myspecialexport.tab'
var textData = 'load of data...'
var success = plugins.file.writeTXTFile(fileNameSuggestion, textData);
if (!success) application.output('Could not write file.');
// For file-encoding parameter options (default OS encoding is used), http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8}{tr:id=name}{td}h6.writeXMLFile{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}writeXMLFile{span}{span:id=iets|style=float: left;}\(file, xml_data){span}{td}{tr}{tr:id=des}{td}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_des|text=|trigger=button}{sub-section}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_des|trigger=none|class=sIndent}Writes data into an XML file. The file is saved with the encoding specified by the XML itself. (Web Enabled){sub-section}{td}{tr}{tr:id=prs}{td}*Parameters*\\{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_prs|text=|trigger=button}{sub-section}{div:class=sIndent}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_prs|trigger=none}file
xml_data
{sub-section}{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_ret|text=|trigger=button}{sub-section}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_ret|trigger=none|class=sIndent}[Boolean]{sub-section}{td}{tr}{builder-show:permission=edit}{tr:id=see}{td}*Also see*\\{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_see|text=|trigger=button}{sub-section}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_see|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{builder-show:permission=edit}{tr:id=link}{td}*External links*\\{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_see|text=|trigger=button}{sub-section}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_link|class=sIndent|trigger=none}{sub-section}{td}{tr}{builder-show}{tr:id=sam}{td}*Sample*\\{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_sam|text=|trigger=button}{sub-section}{sub-section:277299E852977F8E-B4743947-417342E0-8927B640-40D39488F5BA404C78C676D8_sam|class=sIndent|trigger=none}{code:language=javascript}
var fileName = 'form.xml'
var xml = controller.printXML()
var success = plugins.file.writeXMLFile(fileName, xml);
if (!success) application.output('Could not write file.');
{code}{sub-section}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}