applescript

Support “styled text” in a scriptable Mac application (Cocoa Scripting)

。_饼干妹妹 提交于 2020-01-06 04:02:06
问题 My app supports being scripted with Applescript. I am trying to make styled text content, stored in NSAttributedString objects, available to an Applescript user. I thought I could simply deliver styled text with the NSAttributedString class, just like I deliver plain text with the NSString class, but that does not work - Cocoa Scripting then reports that it cannot convert or coerce the data. I wonder if I'm missing something or if this is just plain impossible with the standard classes

How to compile an AppleScript Script Library (scptd) with an Scripting Definition (sdef)

为君一笑 提交于 2020-01-05 10:05:08
问题 I want to be able to decompile and compile and AppleScript Script Library (scptd) with an Scripting Definition (sdef), so I can put the text source in version control. The background of this question is to put my AppleScript sources in git . Most of my questions have been answered by this stackoverflow question/answer, but my question described here is still preventing me from putting all my scripts in git. In this library test.scptd I have an handler with the name say it loud , and in the

Tell system events to keystroke in Xcode?

走远了吗. 提交于 2020-01-05 04:24:09
问题 I'm making an application, in which I need to run a code that will tell system events to keystroke a certain phrase. Like in an AppleScript, I would do: Tell Application "System Events" to keystroke "This is a test" I don't know how to do this from Xcode, and I would really appreciate any help. Thank you! 回答1: You can run an AppleScript from code, e.g., using OSACompileExecute . Also see QA1026. Alternately, you can post keyboard events using the CGEvent APIs. With recent OSes, you may be

What applescript will a particular application accept?

大憨熊 提交于 2020-01-04 14:39:13
问题 I see a lot of applications that can respond to applescript messages such as this one. tell application "Safari" return URL of front document as string end tell How can I query an application to find out what commands it will accept? Is there a tool for doing so? 回答1: In AppleScript Editor, do "Open Dictionary", select the application you are interested in, and you get a nice browser that shows the commands and their documentation (if the developers have chosen to provide any). 来源: https:/

AppleScript access Network Folder

孤者浪人 提交于 2020-01-04 12:49:20
问题 I'm trying to make a backup of a folder on our network to my Desktop but I'm not sure how to access the folder on the shared network. My code is as follows: on run {input, parameters} set desktopFolder to "Macintosh HD:Users:James:Desktop:App Backups:" set todayDate to do shell script "date '+%Y.%m.%d'" set newFolderName to "Backup " & todayDate set destinationFolder to desktopFolder & newFolderName set sourceFolder to "smb://svr01/IT_Department/Design/_team/James/App" tell application

AppleScript access Network Folder

让人想犯罪 __ 提交于 2020-01-04 12:49:07
问题 I'm trying to make a backup of a folder on our network to my Desktop but I'm not sure how to access the folder on the shared network. My code is as follows: on run {input, parameters} set desktopFolder to "Macintosh HD:Users:James:Desktop:App Backups:" set todayDate to do shell script "date '+%Y.%m.%d'" set newFolderName to "Backup " & todayDate set destinationFolder to desktopFolder & newFolderName set sourceFolder to "smb://svr01/IT_Department/Design/_team/James/App" tell application

How to transform a CSV into several lists (applescript)?

爷,独闯天下 提交于 2020-01-04 12:16:51
问题 I have been digging around for this for a while and can't find a solution. I have a CSV with for example the following data: 1,2,3,a,b,c,4,5,6,d,e,f,7,8,9,0 0,9,8,g,h,i,7,6,4,k,l,m,5,4,3,2 etc... Each line contains mostly different data except for certain fields that are either true or false. What i need is to pull each line as a list to then be able to parse the data. I want to be able to remove, for example item number 3 from all the lists and then save the data to be used in a spreadsheet.

How to transform a CSV into several lists (applescript)?

非 Y 不嫁゛ 提交于 2020-01-04 12:16:22
问题 I have been digging around for this for a while and can't find a solution. I have a CSV with for example the following data: 1,2,3,a,b,c,4,5,6,d,e,f,7,8,9,0 0,9,8,g,h,i,7,6,4,k,l,m,5,4,3,2 etc... Each line contains mostly different data except for certain fields that are either true or false. What i need is to pull each line as a list to then be able to parse the data. I want to be able to remove, for example item number 3 from all the lists and then save the data to be used in a spreadsheet.

In applescript, how can I access the keyboard shortcut of a menu item?

筅森魡賤 提交于 2020-01-03 12:06:11
问题 I'm trying to figure out the keyboard shortcut (e.g., shift+cmd+S) of a given menu item in Applescript. The "Probe Menu Bar" script has helped me to access the menu items and even inspect their properties and such, but I've been unable to discover which of these will print out the keyboard shortcut. The probe script is like this: tell process "Finder" get every menu bar tell menu bar 1 get every menu bar item get every menu of every menu bar item get every menu item of every menu of every

In applescript, how can I access the keyboard shortcut of a menu item?

佐手、 提交于 2020-01-03 12:06:08
问题 I'm trying to figure out the keyboard shortcut (e.g., shift+cmd+S) of a given menu item in Applescript. The "Probe Menu Bar" script has helped me to access the menu items and even inspect their properties and such, but I've been unable to discover which of these will print out the keyboard shortcut. The probe script is like this: tell process "Finder" get every menu bar tell menu bar 1 get every menu bar item get every menu of every menu bar item get every menu item of every menu of every