按日期命名的 Applescript 新文件夹 [英] Applescript New Folder Named By Date

查看:31
本文介绍了按日期命名的 Applescript 新文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我是applescript的新手,我正在尝试制作一个应用程序,该应用程序将在桌面上创建一个具有当前日期和时间名称的新文件夹.每次我运行它时,都会出现错误,并显示无法将11/8/13"设为类型编号.请帮助并感谢您的意见和回答!

So I am new to applescript and I am trying to make an application that will make a new folder at the desktop that has the name of the current date and time. Every time I run it, there is and error and it reads, "Can’t make "11/8/13" into type number." Please help and thanks for your input and answers!

    tell application "Finder"
        set p to path to desktop
        set d to short date string of (current date)
        set t to time string of (current date)
        set FullDate to d + t
        make new folder at p with properties {name:FullDate}
    end tell

推荐答案

您使用 &在 AppleScript 中连接,否则它认为您正在尝试添加一个数字.

You use & to concatenate in AppleScript, otherwise it thinks you are trying to add a number.

set p to path to desktop
set d to short date string of (current date)
set t to time string of (current date)
set FullDate to d & space & t

tell application "Finder" to make new folder at p with properties {name:FullDate}

这篇关于按日期命名的 Applescript 新文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆