<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JScript: создание новой папки в Total Commander с именем текущей даты]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=2566&amp;type=atom" />
	<updated>2008-12-12T14:40:48Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=2566</id>
		<entry>
			<title type="html"><![CDATA[JScript: создание новой папки в Total Commander с именем текущей даты]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=17063#p17063" />
			<content type="html"><![CDATA[<p>Сценарий создает в текущей папке новую папку с именем, соответствующим текущей дате в формате YYYYMMDD. Если папка с таким названием уже существует, сценарий создаст новую с именем&nbsp; YYYYMMDD(1), YYYYMMDD(2),...,YYYYMMDD(N).<br /></p><div class="codebox"><pre><code>function setParams(){
 FSO = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
}

function newFolder(){
 var curDate = new Date()
 var newFolderName, curYear, curMonth, curDay, newFolderName, counter, folderCreated; 
 with (curDate) { 
  curYear = getFullYear().toString();
  curMonth = ((getMonth()+1)&lt;10) ? &quot;0&quot;+(getMonth()+1) : (getMonth()+1).toString();
  curDay = (getDate()&lt;10) ? &quot;0&quot;+getDate() : getDate().toString();
 }
 newFolderName = curYear+curMonth+curDay;
 counter = 0;
 folderCreated = false;
 while (! folderCreated){
   if (FSO.FolderExists(newFolderName)) {
    counter++
    newFolderName = curYear+curMonth+curDay+&quot;(&quot;+counter+&quot;)&quot;;
   } 
   else {
    FSO.CreateFolder(newFolderName);
    folderCreated = true;    
   }
 }
}

setParams();
newFolder();</code></pre></div><p>Чтобы сценарий был полезным, в Total Commander в меню [Запуск]-[Изменить меню &quot;Запуск&quot;] нужно добавить пункт c любым названием и сопоставить ему имя файла со скриптом. Далее в меню [Конфигурация]-[Настройка]-[Разное] назначить любое удобное для вас сочетание клавиш, по которому будет создаваться новая папка (я, например, назначил &lt;Shift&gt;-&lt;F7&gt;).</p>]]></content>
			<author>
				<name><![CDATA[Дима_x86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=17984</uri>
			</author>
			<updated>2008-12-12T14:40:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=17063#p17063</id>
		</entry>
</feed>
