我曾经使用两个applescript在Mac OS High Sierra下从台式机1和台式机2(双显示器模式)中找出实际墙纸图像的文件名。一个脚本用于主监视器,另一个脚本用于第二监视器。在Mac OS Mojave下,只有台式机1的脚本仍在工作。桌面2的脚本不再起作用。试图找到问题,但找不到解决方案。我不是经验丰富的applescript作家。希望有人能帮忙。
用于台式机1(主监视器)的脚本1:
tell application "System Events"
set posix_path to (pictures folder of desktop 1)
set picPath to (POSIX file posix_path) as string
end tell
set thepictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=1 and preferences.data_id=data.ROWID\"")
set fullPath to picPath as string
set rotationImage to fullPath & thepictures
tell application "Finder"
try
set aliasItem to item rotationImage
if class of aliasItem is alias file then
reveal original item of aliasItem
end if
end try
end tell
用于台式机2(第二台显示器)的Script2:
tell application "System Events"
set posix_path to (pictures folder of desktop 2)
set picPath to (POSIX file posix_path) as string
end tell
set thepictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=5 and preferences.data_id=data.ROWID\"")
set fullPath to picPath as string
set rotationImage to fullPath & thepictures
tell application "Finder"
try
set aliasItem to item rotationImage
if class of aliasItem is alias file then
reveal original item of aliasItem
end if
end try
end tell
该脚本的预期结果是finder正在打开一个显示实际墙纸图像文件的窗口。它适用于script1,但不适用于script2
答案 0 :(得分:0)
我发现了问题。在High Sierra和Mojave之间的某个位置,活动壁纸图像的桌面2的<h1>Challenge</h1>
<% @questions.each do |question| %>
<div class="container">
<p><%= question.question %></p>
<form>
<% @question_answers.each do |question_answers| %>
<input type="radio" name="gender" value=<%= question_answers.answer %>><%= question_answers.answer %><br>
<% end %>
<input type="submit" value="Submit">
</form>
</div>
<% end %>
号已更改。
在高塞拉山脉,preferences.picture_id
是id
,在莫哈韦沙漠下是preferences.picture_id=5
。
也许这对其他人有帮助。