Search Results

Search found 265 results on 11 pages for 'applescript'.

Page 7/11 | < Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >

  • Close all Mac Terminal windows, but the one running a script

    - by Greg Brown
    I am trying to create a shell script that runs a python simulation programing in 4 terminal windows. I have the script that launches the program four times in four separate terminal windows(total of 5 windows, 4 for the python programs, and one to control the other terminal windows). I want to now create a script that I can run in the control terminal window that closes and kills the programs of the other four terminal windows, but still have the control one open. What I have so far is something like this #!/bin/sh osascript -e 'tell app "Terminal" do script "killall python" end tell' osascript -e 'tell app "Terminal" to quit' osascript -e 'tell app "Terminal" to open' The problem is that the last line doesn't work because it closes all the windows including the one the script is executing in. I am not really familiar with shell or apple script so any help would be welcomed. I posted on Stack, but I think this might be a better place for an automation type question. Thanks

    Read the article

  • Mac Screenshot of a Specific Window without Using the Mouse/Click

    - by huyqt
    Hello, I've been researching for a day or two but can't find a method to take a screenshot of a specific window (possibly the only window) open at a specific time using an Apple script. Currently I have the script execute screencapture -T1 ~/Desktop/screenshot.png But what I want is really screencapture -wx -T1 ~/Desktop/screenshot.png But when I use -wx, it waits for a mouse click on the window. Are there any utilities, built in or not, that will allow me to do this? Thank you so much! (I'm sorry if this belongs on Stack Overflow, can someone move it if it does. It kind of overlaps both super user and stack overflow.) Edit: The windows alternative that I'm looking for on a Mac is the keyboard shortcut: Alt + PrntScrn

    Read the article

  • How can i update Preview.app from the command line without loosing focus on OSX ?

    - by snies
    Hello, i want to update Preview.app in the background from the command line without loosing focus of my current window. I know that i can use the following to open/update the view of a file, but than i loose focus to the Preview.app. open -a Preview foo.pdf I guess there might be some clever Apple Script commands to do so but so far i didn't find the right one. Alternatively i would be interested into transfering the focus back to my current app directly after the update. I need this in order to update Preview.app's view of a pdf through a vi autocmd after i update the pdf according to changes in a tex file i am editing. Here is an example of what i want to achive but using Ubuntu and evince.

    Read the article

  • How to get which file is requested to open using a mac application?

    - by ramsey
    i have created an mac application which can be open my file extensions. But when i tested it, i dont get the path of the file requested to open using the application, instead i got the "psn_0_151589". I checked it for itunes, textedit, xcode and other applications. Below is my app sample main code where i process path of the opened file python code import sys import os.path print("File opened with this app :: ",sys.argv[1]) if(os.path.exists(sys.argv[1]): print("valid file :: { do something...}\n") else: print("Invalid file path received :: { do nothing }\n") OUTPUT : File opened with this app :: psn_0_151589 Invalid file path received :: { do nothing } Hope someone knows how to get the filepath which was opened using any application. Any help would be greatly appreciated. -ramsey

    Read the article

  • Howto update Preview.app from the command line without loosing focus on OSX ?

    - by snies
    Hello, i want to update Preview.app in the background from the command line without loosing focus of my current window. I know that i can use the following to open/update the view of a file, but than i loose focus to the Preview.app. open -a Preview foo.pdf I guess there might be some clever Apple Script commands to do so but so far i didn't find the right one. Alternatively i would be interested into transfering the focus back to my current app directly after the update. I need this in order to update Preview.app's view of a pdf through a vi autocmd after i update the pdf according to changes in a tex file i am editing. Here is an example of what i want to achive but using Ubuntu and evince.

    Read the article

  • Howto update Preview.app from the command line without losing focus on OSX ?

    - by snies
    Hello, i want to update Preview.app in the background from the command line without losing focus of my current window. I know that i can use the following to open/update the view of a file, but than i lose focus to the Preview.app. open -a Preview foo.pdf I guess there might be some clever Apple Script commands to do so but so far i didn't find the right one. Alternatively i would be interested into transfering the focus back to my current app directly after the update. I need this in order to update Preview.app's view of a pdf through a vi autocmd after i update the pdf according to changes in a tex file i am editing. Here is an example of what i want to achive but using Ubuntu and evince.

    Read the article

  • Save as PDF to Folder Script for Apple Mail

    - by patte
    I want to add a script to a rule to auto-print messages as PDF to a specific Folder. What I found was this: http://is.gd/acmsE but it doesn't work for me on OS X 10.6. I already know the Save to PDF command and that you can create simple aliases in the "PDF Services" folder, but I need something automated for this task. I searched the web the whole morning and also tried to write my own Automator workflow but couldn't manage it Any help is highly appreciated.

    Read the article

  • Mac OS : creating a background periodic simple script

    - by Julien
    Hi folks ! I have a friend who wants something quite easy : he has a mac, and he would like a very simple script/app that runs in the background. The goal is to replace a file every 5 minutes with one downloaded from the internet. I would also like a menu on the top bar (like the clock on Mac Os, the wifi, the sound, Dropbox,...) What would be the easiest way to do that ? Objective C ? AppleScript ? Do you guys have any inspiration for that ? Thanks a lot Julien

    Read the article

  • Speech Recognition Server Does Not Stay Open

    - by Waffle
    I am trying to create a simple program that loops for user speech input using com.apple.speech.recognitionserver. My code thus far is as follows: set user_response to "start" repeat while user_response is not equal to "Exit" tell application id "com.apple.speech.recognitionserver" set user_response to listen for {"Time", "Weather", "Exit"} with prompt "Good Morning" end tell if user_response = "Time" then set curr_time to time string of (the current date) set curr_day to weekday of (the current date) say "It is" say curr_time say "on" say curr_day say "day" else if user_response = "Weather" then say "It is hot outside. What do you expect?" end if end repeat say "Have a good day" If the above is run on my system it says good morning and it then pops up with the speech input system and waits for either Time, Weather, or Exit. They all do what they say they are going to do, but instead of looping if I say Time and Weather and asking again until I say exit the speechserver times out and never pops up again. Is there a way of either keeping that application open until the program ends or is applescript not capable of looping for user speech input?

    Read the article

  • Creating iPhoto albums using Cocoa Scripting Bridge

    - by robinjam
    I'm tearing my hair out trying to create a new album from a Cocoa Application. In applescript it's a nice simple procedure: tell application "iPhoto" new album name "Album" end tell But I can't work out how this is done in Cocoa via the Scripting Bridge. I've tried this: iPhotoApplication *iPhoto = [SBApplication applicationWithBundleIdentifier:@"com.apple.iPhoto"]; iPhotoAlbum *newAlbum = [[[[iPhoto classForScriptingClass:@"album"] alloc] initWithProperties:[NSDictionary dictionaryWithObject:@"Album" forKey:@"name"]] autorelease]; [[iPhoto albums] addObject:newAlbum]; But that had no effect. Please help!

    Read the article

  • View plain text files with different background colors in Mac OSX, for different programming languag

    - by Werner
    Hi, I work with Mac OS X Leopard. I usually have 5 or 10 text files opened at the same time with different programming languages; one for a bash script, another for a python one, etc. When I use exposé all of them look the same, so it is difficult to select them. I wonder how could I work with just plain text files in OSX, so when they are opened in an editor the background color changes or some other thign, so when using exposé it is clear to me which window belongs to what language. I thought about inserting some kind of info to the last line of each document, and then creat some applescript that converts it to RTF or someother text document which includes color in bacjground, so then it is opened with textmate or someother app. Do you know a better approach for this? Thanks

    Read the article

  • Receiving Text From Another Application

    - by Garry
    Hi, I'm building some home automation software with Cocoa/Objective-C. The main application will have a minimal GUI and will most likely be represented by a status bar icon only. I'm using proprietary speech-to-text software (MacSpeech Dictate) that takes my voice command and converts it to plain text. I then need to send this plain text to my app for parsing. Is there a way to send a string to a Cocoa application? Could AppleScript achieve this? How would I make the NSString string in my app "available" to receive the passed string? For reasons that are beyond the scope of this question - it is not possible to dictate the command directly into my app. Many thanks in advance,

    Read the article

  • Is it possible to make a script/plugin for Finder to toggle hidden files without relaunching?

    - by Andrei
    There are several ways how to toggle hidden files in Finder - via a shell command, or AppleScript, or Automator action, or even a Dashboard widget. All of them are doing the same thing and unfortunately require to close and reopen Finder windows, which is quite annoying. On the other hand, for the Open File dialog one can easily toggle hidden files by pressing Command+Shift+Period. Is it possible to make a script or plugin for Finder to toggle hidden files w/o relaunching? How would you make it?

    Read the article

  • Transforming a TXT file in a list, getting wrong

    - by Mike
    I have a txt plain file that has a list of numbers. One number per line, like: 978-972-722-649-8 978-972-722-646-7 978-972-722-627-6 978-972-722-625-2 978-972-722-594-1 etc. This list is on a file called file.txt, was created and saved on TextEdit using Western (ISO Latin 1) encoding. Now I am trying to use Applescript to read this file and transform it on a list. I have this script set myDirectory to path to desktop folder as string set myFile to myDirectory & "file.txt" try set open_file to ¬ open for access file myFile without write permission set myList to read open_file using delimiter return close access open_file on error try close access file open_file end try end try after running this script, myList contains just ONE item and this item is "97" (I suppose that is the first two numbers of the first entry). What is going on? Thanks.

    Read the article

  • AuthorizationExecuteWithPrivileges and osascript failing

    - by cygnl7
    I'm attempting to execute an uninstaller (written in AppleScript) through AuthorizationExecuteWithPrivileges. I'm setting up my rights after creating an empty auth ref like so: char *tool = "/usr/bin/osascript"; AuthorizationItem items = {kAuthorizationRightExecute, strlen(tool), tool, 0}; AuthorizationRights rights = {sizeof(items)/sizeof(AuthorizationItem), &items}; AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed; status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL); Later I call: status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, (char *const *)args, NULL); On Snow Leopard this works fine, but on Leopard I get the following in syslog.log: Apr 19 15:30:09 hostname /usr/bin/osascript[39226]: OpenScripting.framework - 'gdut' event blocked in process with mixed credentials (issetugid=0 uid=501 euid=0 gid=20 egid=20) Apr 19 15:30:12: --- last message repeated 1 time --- ... Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: /var/folders/vm/vmkIi0nYG8mHMrllaXaTgk+++TI/-Tmp-/TestApp_tmpfiles/Uninstall.scpt: Apr 19 15:30:12 hostname [0x0-0x2e92e9].com.example.uninstaller[39219]: execution error: «constant afdmasup» doesn’t understand the «event earsffdr» message. (-1708) Am I going about this all wrong? I just want to run the equivalent of "sudo /usr/bin/osascript ..."

    Read the article

  • Using ScriptingBridge framework for communicating with Entourage

    - by Subramanian Ganapathy
    Hi, The motivation for my question is the following doc, which describes how mail.app could be integrated using ScriptingBridge: http://developer.apple.com/mac/library/samplecode/SBSendEmail/Introduction/Intro.html I tried to apply a similar technique with Entourage as well but could not get any results so far. I understand that using AppleScript would help me solve my problem and mactech.com has extensive documentation for doing so. But i find this ScriptingBridge technique elegant and want to figure why it is not working for me with Entourage. The biggest problem seems to be my inability to create Scripting classes based on their names as it happens in Mail because Entourage has a different interface than Mail as their headers indicate. Could someone please tell me what I am missing or provide any sort of hint on why this wont work? I am also adding sample code ` MicrosoftEntourageApplication * mail = [SBApplication applicationWithBundleIdentifier:@"com.Microsoft.Entourage"]; MicrosoftEntourageOutgoingEmailMessage * emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: @"my sample subject", @"subject", @"my sample body", @"content", nil]]; //then i create a set of recipients and try to use "to recipient" as the string scripting class id, but MicrosoftEntourageRecipient is returned as nil MicrosoftEntourageRecipient * theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: @"[email protected]", @"address", nil]]; ` I am trying to make the simple thing work, I am not even concentrating on the task I am supposed to do now. I am a Cocoa beginner( and willing to learn ), please excuse an syntactic naivetes and do point them out in the sample code, in addition to answering my question. Best Regards, Subramanian

    Read the article

  • NSTask Launch causing crash

    - by tripskeet
    Hi, I have an application that can import an XML file through this terminal command : open /path/to/main\ app.app --args myXML.xml This works great with no issues. And i have used Applescript to launch this command through shell and it works just as well. Yet when try using Cocoa's NSTask Launcher using this code : NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/open"]; [task setCurrentDirectoryPath:@"/Applications/MainApp/InstallData/App/"]; [task setArguments:[NSArray arrayWithObjects:[(NSURL *)foundApplicationURL path], @"--args", @"ImportP.xml", nil]]; [task launch]; the applications will start up to the initial screen and then crash when either the next button is clicked or when trying to close the window. Ive tried using NSAppleScript with this : NSAppleScript *script = [[NSAppleScript alloc] initWithSource:@"tell application \"Terminal\" do script \"open /Applications/MainApp/InstallData/App/Main\\\\ App.app\" end tell"]; NSDictionary *errorInfo; [script executeAndReturnError:&errorInfo]; This will launch the program and it will crash as well and i get this error in my Xcode debug window : 12011-01-04 17:41:28.296 LaunchAppFile[4453:a0f] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find: /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper LaunchAppFile: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers. So with research i came up with this : NSAppleScript *script = [[NSAppleScript alloc] initWithSource:@"do shell script \"arch -i386 osascript /Applications/MainApp/InstallData/App/test.scpt\""]; NSDictionary *errorInfo; [script executeAndReturnError:&errorInfo]; But this causes the same results as the last command. Any ideas on what causes this crash?

    Read the article

  • Indesign scripting - Save Copy

    - by BobC
    Hello, I'm using a Objective-C Scripting Bridge to communicate with InDesign CS3/CS4. Unfortunately I'm stuck on Save command which appears to be existing only as a part of the standard suite and not defined again in InDesign. Because of that it looks like I can Save, Save as but not Save Copy a document. Does anyone have any idea how to proceed? Just to shortly explain the difference between Save and Save Copy - using Save Copy the current doc doesn't change which is opposite to Save or Save as.

    Read the article

  • How can I close a Window using the OS-X ScriptingBridge framework, from Perl?

    - by Gavin Brock
    Problem... Since MacPerl is no longer supported on 64bit perl, I am trying alternative frameworks to control Terminal.app. I am trying the ScriptingBridge, but have run into a problem passing an enumerated string to the closeSaving method using the PerlObjCBridge. I want to call: typedef enum { TerminalSaveOptionsYes = 'yes ' /* Save the file. */, TerminalSaveOptionsNo = 'no ' /* Do not save the file. */, TerminalSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ } TerminalSaveOptions; - (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. Attempted Solution... I have tried: #!/usr/bin/perl use strict; use warnings; use Foundation; # Load the ScriptingBridge framework NSBundle->bundleWithPath_('/System/Library/Frameworks/ScriptingBridge.framework')->load; @SBApplication::ISA = qw(PerlObjCBridge); # Set up scripting bridge for Terminal.app my $terminal = SBApplication->applicationWithBundleIdentifier_("com.apple.terminal"); # Open a new window, get back the tab my $tab = $terminal->doScript_in_('exec sleep 60', undef); warn "Opened tty: ".$tab->tty->UTF8String; # Yes, it is a tab # Now try to close it # Simple idea eval { $tab->closeSaving_savingIn_('no ', undef) }; warn $@ if $@; # Try passing a string ref my $no = 'no '; eval { $tab->closeSaving_savingIn_(\$no, undef) }; warn $@ if $@; # Ok - get a pointer to the string my $pointer = pack("P4", $no); eval { $tab->closeSaving_savingIn_($pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$pointer, undef) }; warn $@ if $@; # Try a pointer decodes as an int, like PerlObjCBridge uses my $int_pointer = unpack("L!", $pointer); eval { $tab->closeSaving_savingIn_($int_pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$int_pointer, undef) }; warn $@ if $@; # Aaarrgghhhh.... As you can see, all my guesses at how to pass the enumerated string fail. Before you flame me... I know that I could use another language (ruby, python, cocoa) to do this but that would require translating the rest of the code. I might be able to use CamelBones, but I don't want to assume my users have it installed. I could also use the NSAppleScript framework (assuming I went to the trouble of finding the Tab and Window IDs) but it seems odd to have to resort to it for just this one call.

    Read the article

  • Apple Script error: Can't get Folder

    - by Jonathan Hirsch
    I started using apple script today, because I wanted to be able to automatically send files to someone when they go into a specific folder. I first tried with automator, but the files were never attached into emails, so i figured i could try with apple script. At first, I tried simply create an email with an attached file. The email was created, but the file was not attached. After a while, I stumbled onto this post that was trying to list files from a folder, so I tried that just to compare it to my code. It gave me an error telling me it is impossible to list files from that folder. So I tried setting a path to a specific folder, and I got an error saying the path can't be made. This is the code I used for the last part: tell application "Finder" set folderPath to folder "Macintosh HD: Users:Jonathan:Desktop:Send_Mail" set fileList to name of every file in folderPath end tell and this is the error I got. error "Finder got an error: Can’t get folder \"Macintosh HD: Users:Jonathan:Desktop:Send_Mail\"." number -1728 from folder "Macintosh HD: Users:Jonathan:Desktop:Send_Mail". I later tried with another folder, and I always get this error, even when using the Users folder for example. Any Suggestions? thanks

    Read the article

  • pdf2swf using MAC OS Batch command or Apple script

    - by Garth Humphreys
    How do I write a batch process on the Mac for pdf2swf, I want to convert all pdfs in a folder into swf. But pdf2swf doesn't have a option to convert a folder of pdfs to swfs, you have to do it one at a time. I'm not sure how if I should use a Apple script or a Shell script, either one I'm not sure how to get or assign a file name variable. pdf2swf file_name_variable.pdf -o file_name_variable.swf -T 9 -f Thanks

    Read the article

  • Automate open dialog box

    - by Andrey M.
    Is there any way to automate a opening files with open dialog box on Mac OS? The application asks user to open files with the standard open dialog box. But I need open files automatically. The idea is to write script or a small application which will click the button in the target application to open dialog box and then somehow select files which I needed. But I don't know how can I do it. Any suggestions will be very appreciated.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >