applescript

Positioning a window with AppleScript using dual monitors

纵饮孤独 提交于 2019-12-13 11:45:50
问题 I have two monitors set up and I am trying to position the window of an application in the second monitor but nothing I do seems to work. For example I am using my laptop and the terminal window is maximized on the screen. Then I plug in an external monitor. I then want to run the applescript and have the terminal maximize on the larger second monitor. Here is what I have right now: set monitorTwoPos to {1050, -600} set monitorTwoSze to {1200, 1920} tell application "Microsoft Outlook" set

How to get name of frontmost app with AppleScript and use it to get the filepath

时间秒杀一切 提交于 2019-12-13 11:40:31
问题 What I try to do: When I'm in one of my text editors (TextEdit, Byword, FoldingText) I want this AppleScript to display the file path. I figured asking for the frontmost window app get's me the apps name nice and easily and then I can ask for the POSIX path in the next step. The Problem: The script is already 99% there, but I'm missing something. When I try to use the variable of activeApp it doesn't work and I get this error: Error Number:System Events got an error: Can’t get application {

How to refresh browser view in finder window(mac os 10.5)?

大兔子大兔子 提交于 2019-12-13 08:35:36
问题 I want to refresh all NSTableView in NSBrowserView of finder on mac os 10.5. For refreshing icon view , list view and flow list view, i am using apple script. @"tell application \"Finder\" to update every item in front window" In browser view this script is only refreshing last column. For example , this script is refreshing only third column(icns-copy.m.....). Can anyone please help me out? 回答1: It's only refreshing the last column because every Finder window has exactly one target folder at

Applescript Get value of property by string name of property

眉间皱痕 提交于 2019-12-13 08:18:54
问题 In AppleScript. Let's say I have a record with a property called Title. Let's say I set a variable to the text "Title"; can I use that variable to get the value of the property Title? Basically, is there any way to do something like this: set result to property named "Title" of myRecord Instead of: set result to Title of myRecord 回答1: I found the answer. I also realize I didn't ask the correct question. The value I'm trying to obtain is from a property list item. Here's what I learned, and

Add scriptable property to Cocoa application derived from NSObject <NSApplicationDelegate>?

 ̄綄美尐妖づ 提交于 2019-12-13 07:36:47
问题 Can someone point me to an example of this working. I just want to set a property value via AppleScript. I have gone through all of the scriptable examples, which are setup differently. <?xml version="1.0" encoding="UTF-8"?> <dictionary title=""> <suite name="Circle View Scripting" code="bccS" description="Commands and classes for Circle View Scripting"> <class name="application" code="capp" description="" > <cocoa class="NSApplication"/> <property name="circletext" code="crtx" type="text"

How do I refer to an object in a window whose Accessibility Inspector description is “<empty description> (group) [NSBox]” in Applescript?

…衆ロ難τιáo~ 提交于 2019-12-13 07:24:19
问题 I am trying to interact with iTunes "Export Library.." dialog. I tried "set choices to every menu item of menu 1 of pop up button 1 of group 1 of window winName" but it says "group 1" is an invalid index? Here's the relevant code: (the call parameters are: "iMac-8GB", "iTunes", "iTunes", false" on handleDir(dir, winName, appName, createIt) local foundIt, ndx set foundIt to false if winName is not "" then tell application "System Events" to tell process "iTunes" set choices to every menu item

Hazel Fails to Attach File to Email (El Capitan)

﹥>﹥吖頭↗ 提交于 2019-12-13 07:19:01
问题 I currently have a set of Hazel routines that all use the same AppleScript, included infra . The routine does the following: Monitors Folder and examines PDFs placed into Folder for certain strings. If a matching string is found: Renames the matched file using the following scheme: name—email—extension (i.e., it inserts an email address, which is predefined in the Hazel routine). Runs the AppleScript (again, infra ). Moves the matched file to an archive folder. Here is the AppleScript: on

AppleScript: substring to string or format html

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:14:46
问题 I'm working on my applescript right now and I'm stuck here.. Lets take this snippet as an example of html code <body><div>Apple don't behave accordingly <a href = "http://apple.com>apple</a></div></body> What I need now is to return the word without the html tags. Either by deleting the bracket with everything in it or maybe there is any other way to reformat html into plain text.. The result should be: Apple don't behave accordingly apple 回答1: How about using textutil? on run -- example (don

Applescript: Open Excel File and Save in a Different Format (same name and path)

↘锁芯ラ 提交于 2019-12-13 07:07:08
问题 I have a folder of .xls files of which some are genuine excel files and some are excel xml files (but still with the .xls extension). To work with the files in a separate program, I'm trying to convert them all to a consistent format (Excel 98-2004) and want to use an applescript to do this while retaining the original file names and directory structure. As of now, I have a working loop and list of files, and am accomplishing everything but the save function: set file_Name to "/Users/me/path

Applescript wrap lines with HTML tags and MarsEdit.app script problem

牧云@^-^@ 提交于 2019-12-13 05:41:36
问题 Im currently using a script in MarsEdit.app which has a flaw. It checks the HTML document for cases where paragraphs are wrapped with <p> tags as follows: -- If already starts with <p>, don't prepend another one if not {oneParagraph starts with "<p>"} then set newBodyText to newBodyText & "<p>" end if set newBodyText to newBodyText & oneParagraph The problem here is that if the paragraph (or single line) is wrapped with any other HTML tag other than a <p> tag the script wraps <p> tags across