User Name
Password
AppleNova Forums » Programmer's Nook »

Using 'Get' command in Applescript


Register Members List Calendar Search FAQ Posting Guidelines
Using 'Get' command in Applescript
Thread Tools
Jason
Veteran Member
 
Join Date: Oct 2004
 
2010-08-08, 15:13

Hi there,

I'm trying to get an application to open a highlighted/selected file and then open it. The file is not the same every time so I cannot define it in the script.
Where am I going wrong?

Code:
get selectedFile tell application "Adobe Photoshop CS3" activate end tell
Regards
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2010-08-08, 15:26

I'm confused. Is the file selected in Finder? If so, how are you invoking the script? Or would you like the script to prompt the user for a file to choose?

If it's selected in Finder, try something like this:

Code:
tell application "Finder" set theFile to the selection as alias end tell tell application "Adobe Photoshop CS3" activate open theFile end tell
If you wish the user to choose a file, that would be:

Code:
set theFile to choose file tell application "Adobe Photoshop CS3" activate open theFile end tell
These scripts were both tested, albeit with Preview, not Photoshop.
  quote
Jason
Veteran Member
 
Join Date: Oct 2004
 
2010-08-08, 15:27

Sorry. That was a bit vague. The file is already selected in the finder. Then invoke it through Launchbar or something similar.

Regards
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2010-08-08, 15:33

I've amended my post with working code.
  quote
Jason
Veteran Member
 
Join Date: Oct 2004
 
2010-08-08, 15:35

Chucker, thanks so much. I really appreciate it!
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Learning AppleScript jdcfsu Programmer's Nook 10 2009-08-05 14:38
A new post: Applescript prestigerg1570@aim.com Programmer's Nook 16 2006-10-03 09:51
Help with applescript: how to get a url with specified name ironlung Programmer's Nook 4 2006-05-01 03:52
Applescript problem pmazer Programmer's Nook 1 2005-12-08 01:15
Audio applescript ericarthur Genius Bar 0 2005-03-03 17:16


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 09:27.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova