applescript

Applescript get last opened date of file

Deadly 提交于 2019-12-08 04:05:38
问题 I can use set modDate to the modification date of theFile as string to get the last modified date of a file, and set modDate to the creation date of theFile as string to get the date when the file was created. Is there anything like last opened date to get the date when the file was last opened? 回答1: Yes. There is a UNIX command called kMDItemLastUsedDate that returns the date the target item was last used. set the Last_opened_date to (do shell script "mdls -name kMDItemLastUsedDate " &

How can I write UTF-8 files using JavaScript for Mac Automation?

故事扮演 提交于 2019-12-08 03:58:00
问题 In short - what is the JavaScript for Mac Automation equivalent of AppleScript's as «class utf8» ? I have a unicode string that I'm trying to write to a text file using JavaScript for Mac Automation. When writing the string to the file, any unicode characters present become question marks in the file (ASCII char 3F ). If this was an AppleScript script instead of a JavaScript one, I could have solved this by adding the as «class utf8» raw statement as explained on Takashi Yoshida's Blog (https

How can I detect if the screen is locked or screensaver is active from the Terminal in OS X 10.6?

两盒软妹~` 提交于 2019-12-08 03:18:49
问题 Due to the new limitations of Kerberos in OS X 10.6, I'm working on a script that offers similar functionality to what used to be available in 10.5. Essentially it parses the klist output to see if your ticket is expiring and displays how long until it expires. If we hit the 10 minute mark, it calls kinit to do a GUI password prompt to ask for your kerberos password. If the ticket is expired it does the same thing. The script makes sure that kinit is not running before calling it again so we

In Applescript, how can I get to the Help menu Search field, like Spotlight?

柔情痞子 提交于 2019-12-08 03:15:53
问题 In OS X, in order to quickly get at menu items from the keyboard, I want to be able to type a key combination, have it run a script, and have the script focus the Search field in the Help menu. It should work just like the key combination for Spotlight, so if I run it again, it should dismiss the menu. I can run the script with Quicksilver, but how can I write the script? 回答1: Alternatively, hit cmd-? and don't mess with the script. :-) That puts key focus in the help menu's search field. 回答2

Run another application using AppleScript without showing it on the dock

时光怂恿深爱的人放手 提交于 2019-12-08 02:20:47
问题 Using AppleScript you can create a script that runs another application, and then save that script itself as an application and place it in the dock. The problem (not really a problem) is that when you click it, it will still show the other application on the dock. Is it possible to prevent the other application from showing in the dock, yet show its GUI as it would normally do when executed? Thanks 回答1: The only solution I can think of is to actually modify the 'other app' to have no Dock

Change Applescript into single line NSApplescript source

。_饼干妹妹 提交于 2019-12-08 02:14:28
问题 Im building an app for learning purposes of using applescript to send multiple commands during an action. Below is the code I'm messing with but I have stripped out the actions in between the "" and replaced them with numbers. Everything works fine in applescript but making this into an NSApplescript initwithsource: line has been a bother. tell application "Terminal" activate set currentTab to do script "1" do script "2" in currentTab do script "3" in currentTab do script "4" in currentTab

Sending data from AppleScript to FileMaker records

*爱你&永不变心* 提交于 2019-12-08 02:13:49
问题 I'm computing some data in AppleScript that I'd like to then insert into a specific FileMaker record. Here's my AppleScript: on sendDataToFM(FileNameWithExtension, ClipLength) tell application "FileMaker Pro Advanced" show every record of database 1 show (every record whose cell "File Name" = FileNameWithExtension) repeat with i from 1 to (count record) set MatchingRecord to record i set data cell "CLIP LENGTH" of MatchingRecord to ClipLength end repeat end tell end sendDataToFM ... my

Applescript Error cannot make to unicode text

99封情书 提交于 2019-12-08 02:01:47
问题 I'm trying to write a simple applescript script to get the contents of WriteRoom (a simple text editor) and run it through a markdown parser then copy the resulting html to the clipboard: tell application "WriteRoom" to activate tell application "System Events" to keystroke "a" using command down tell application "System Events" to keystroke "c" using command down set the clipboard to (do shell script "cd ~;echo \"" & (the clipboard) & "\" >> writeroom.md; /usr/local/bin/markdown writeroom.md

AppleScript: Create new folder from file name and move file into that folder

断了今生、忘了曾经 提交于 2019-12-08 01:59:28
问题 Basically, I'm trying to create a folder action in Automator so whenever a file is added to a specific folder, it will create a subfolder that matches the filename (without the extension), then move the file into that subfolder. So far, I have successfully used a post from this site (Create new folder named with a specified file name in Automator) to create a script that will create the new folder. However, I have been unable to modify the script to move the original file into the new folder.

Check is phone registered in iMessage

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 00:35:29
问题 I'm trying to check if phone not from my contact list is registered in the iMessage. There is two general approaches that I've tryed. Send message to phone number if it's in buddy list on run argv set toAddress to "+380631111111" set message to "Test" tell application "Messages" set targetService to 1st service whose service type = iMessage set targetBuddy to buddy toAddress of targetService delay 1 if targetBuddy exists then send message to targetBuddy end if #delay 5 end tell end run Why it