applescript

Xcode 4 : Can I get a path to the currently active file via AppleScript?

旧时模样 提交于 2020-01-13 09:15:15
问题 I am trying to write a custom xcode4 behavior to check out the current active file with Perforce. I know I can write a custom behavior to run when hit a key (e.g., F1 ) I'd like that custom behavior to launch an AppleScript (or any kind of script for that matter) that discerns the currently "active" source document in Xcode, get its path, and attempt to check it out via Perforce. As far as I can tell AppleScript is the best way to get to the target document as it can navigate the Xcode DOM

Copy pure text from clipboard using AppleScript

十年热恋 提交于 2020-01-13 03:00:11
问题 Situation Open a Word Document. Copy some formatted text from inside the document to the clipboard. Paste it into an instance of CKEditor CKEditor received smelling M$-style HTML with tons of useless html elements and styles. Even removing formatting using CKEditor's feature does not render pure text. Desired solution Could anybody provide an AppleScript, which removes the styled-/HTML-string and pastes the pure text part back to clipboard . A plus would be a short hint, how to bind the

Java ScriptEngineManager no longer works with Mountain Lion's AppleScript

China☆狼群 提交于 2020-01-12 14:33:13
问题 Ever since I upgraded to Mountain Lion, I can't run my AppleScript code through the Java ScriptEngineManager. The sample code found on Apple's page (link) returns null for the engine object. public static void main(String[] args) throws Throwable { String script = "say \"Hello from Java\""; ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName("AppleScript"); engine.eval(script); } Anybody know of any workarounds? 回答1: I got it working by adding a file

How to pass an arbitrary AppleScript Record to Cocoa in a scriptable app?

可紊 提交于 2020-01-12 08:28:11
问题 I have a Cocoa application with an AppleScript dictionary described in a .sdef XML file. All of the AppleScript classes, commands, etc. defined in the sdef are working property. Except for my "submit form" command. The "submit form" command is my only command attempting to pass a parameter that is an arbitrary hashtable of information from AppleScript to Cocoa. I assume this should be done by passing an AppleScript record which will be automatically converted to an NSDictionary on the Cocoa

Applescript (osascript): opening split panes in iTerm 2 and performing commands

雨燕双飞 提交于 2020-01-11 01:28:12
问题 The following works to open two tabs in iTerm 2. I can't seem to figure out how to get this to using split panes instead. I've tried applying what I see on several forums, but it never works. Could someone point me in the right direction? osascript <<-eof tell application "iterm" set myterm to (make new terminal) tell myterm launch session "Default session" tell the last session set name to "Server" write text "cd $projectsFolder" end tell launch session "Default session" tell the last

Apple Script working fine but with Objective C Library not getting expected out put

浪尽此生 提交于 2020-01-09 08:17:06
问题 I tried running apple script #! /usr/bin/osascript do shell script "chmod 777 /Library/ColorSync/Profiles" with administrator privileges It perfectly working in script editor and terminal. But not able to run with Objective C. Any help will be appreciated. -(void)executeAppleScript{ NSDictionary* errorDict; NSAppleEventDescriptor* returnDescriptor = NULL; NSAppleScript* scriptObject = [[NSAppleScript alloc] initWithSource: @"#! /usr/bin/osascript do shell script \"chmod 777 /Library/ColorSync

Applescript, show all files with tag

蓝咒 提交于 2020-01-07 04:56:05
问题 I am trying to build an applescript which will open show all files tagged with the school class I am currently in, based on current time. For instance, if the time is 10 AM on a Tuesday, it will show all my files tagged with Chemistry. Now, I have made the AppleScript to get the correct name of the class. Now I need to tell Finder to open the files with the correct tags. How would I do this? Basicaly, something like this: set tagged to "Tag:Chemistry" tell application "Finder" reveal tagged

Applescript indicates resource not found when trying to call within inside the app

橙三吉。 提交于 2020-01-06 15:28:06
问题 Playing with AppleScript I am confused on what I am doing wrong when I try to call another AppleScript from the Scripts folder. My current script is saved as foo.app and I see the structure from the Bundle Contents but when I try to call bar.app from inside the Scripts folder I get a dialog of Resource not found . After referencing "How to access from AppleScript a bundled file within a Cocoa-AppleScript Application?" I tried: tell application "Finder" set thisFolder to (container of (path to

Batch Renaming Folders in AppleScript, Will Only Change Names of Every Other Folder

时光毁灭记忆、已成空白 提交于 2020-01-06 15:02:14
问题 I am trying to write a script that renames folders in subfolders. In other words, the taxonomy will go from: Directory/Company X/1 Directory/Company X/2 Directory/Company X/3 Directory/Company X/4 Directory/Company X/5 Directory/Company X/6 Directory/Company X/7 Directory/Company X/8 Directory/Company X/9 Directory/Company X/10 Directory/Company X/info to Directory/Company X/Project 1_1 Directory/Company X/Project 2_2 Directory/Company X/Project 3_3 etc.. So far I have: tell application

Translate into Apple Events AppleScript

北慕城南 提交于 2020-01-06 08:26:29
问题 I have an very simple applescript: tell application "Opera" get URL of active tab of window 1 end tell I want to see Apple Events underlying. So I have launched it with these two environment variables enabled: export AEDebugSends=1; export AEDebugReceives=1 Now I am getting this output: osascript browser.scpt {core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID