我正在运行下面的代码来重命名启动盘,执行一些过程我的问题是,在执行完这些过程后,我是否可以将磁盘重命名为它的名称“原始”。
也就是说,我有一个名为"Big Sur“的磁盘,并运行下面的代码,它被重命名为:"Apple HD”,但在执行其他任务后不久,它将名称返回到: Big Sur我试图将名称存储在一个变量中,但这不起作用,因为启动盘在运行时被重命名为"Apple HD“。
tell application "Finder" to set diskName to name of startup disk
set newName to "Apple HD"
tell application "Finder"
to set newName to diskName
end tell发布于 2021-10-20 04:08:43
-- save original name into the variable, to restore it later
tell application "Finder" to set diskName to name of startup disk
-- rename startup disk
tell application "Finder" to set name of startup disk to "Apple HD"
-- perform some procedures here
-- rename startup disk back to original name
tell application "Finder" to set name of startup disk to diskNamehttps://stackoverflow.com/questions/69633819
复制相似问题