Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

passing parameter to AppleScript app: possible?

I want to use IBM Notes LotusScript to open a folder in Finder. I can successfully use the the LotusScript Shell() command to call an Applescript app I wrote, example:


result = Shell("open -a OpenMyFolder.app")


That works.



My Applescript app with HARDCODED FOLDER is this:


set mylocation to "smb://server.domain.com/sharename/afolder"




tell application "Finder"

open locationmylocation

activate

end tell

It works.

What I need is to be able to pass the folder name to my app from the LotusScript Shell() command, as in:

result = Shell("open -a OpenMyFolder.app smb://server.domain.com/sharename/afolder")

Is there any way to do this?

Thank you in advance....

Trey

MacBook Pro, OS X Yosemite (10.10.2)

Posted on Feb 12, 2015 9:13 AM

Reply
8 replies

Feb 12, 2015 9:58 AM in response to yert33

The OS X command open does not take other arguments such as smb server path. Instead, replace the contents of your Lotus shell as follows:


shell("osascript openmyfolder.app 'smb://server.domain.com/sharename/afolder'")


The AppleScript:


on run argv

tell application "Finder"

activate

open location (item 1 of argv) as text

-- display dialog (item 1 of argv) as text

end tell

end run

Feb 12, 2015 1:37 PM in response to yert33

I am not where I can test an SMB mount, but see if the following AppleScript will get it mounted. Also, try this in the Terminal before sticking it in a Lotus script shell. Use the IP address, not the dns name. You may be required to also supply the workgroup, username, and password.


osascript -e 'mount volume "smb://server.domain.com/sharename/afolder"'


on run argv

try

mount volume (item 1 of argv) as text

end try

end run

Feb 17, 2015 3:00 PM in response to VikingOSX

Sorry I've been away.


VikingOSX: You say in your original reply that "The OS X command open does not take other arguments such as smb server path. " But as you can see in my original post Open is taking an SMB server path within my OpenMyFolder.App.

The App will open the network folder when the SMB server path is hardcoded into the applescript.

The LotusScript will successfully run OpenMyFolder.app.


As to your last reply (much appreciated BTW):

The osascript does not mount the folder. Not sure if I'm really wanting to mount "the folder".


Using my LotusScript to send an osascript command to OSX....does it need to run in Terminal?


Thanks again.


Trey

Feb 17, 2015 5:22 PM in response to yert33

The difference between using open location, and mount volume in AppleScript is that the former will open the smb folder contents in a Finder window, and the latter will simply place the folder icon on the Desktop. In either case, the folder contents are accessible in /Volumes/afolder.


So it is a matter of personal taste which effect you want to achieve.


Mount afolder at /Volumes and show content in a Finder window:


on run argv


tell application "Finder"

activate

open location (item 1 of argv)

end tell


end run


or mount afolder at /Volumes and only show an afolder icon on the Desktop:


on run argv


try

mount volume (item 1 of argv)

end try


end run

In the AppleScript Editor, you would compile, and then save as applications, your choice of these scripts, as OpenMyFolder.app.


In your Lotus Script, either of the following invocations should do the job. You should provide the appropriate path to where the OpenMyFolder.app is located.


result = Shell("open -a OpenMyFolder.app smb://server.domain.com/sharename/afolder")


result=Shell("osascript OpenMyFolder.app smb://server.domain.com/sharename/afolder")

passing parameter to AppleScript app: possible?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.