leleleo
leleleo

Reputation: 11

how can I open "Network" folder with applescript

I have this script:

set filename to getLocalizedString("Finder", "AXICON5")
--set openIP to filename & PCIP
tell application "Finder" to activate
tell application "Finder"
      try
     --open folder openIP
     --on error errMsg number errNbr
     open folder filename
      end try
 tell application "Finder" to activate
end tell
on getLocalizedString(a, x)
     tell application a to return localized string x
end getLocalizedString

What I'm trying to do is open a folder in "Network" folder. If fail, open "Network" folder. What's more, the app is localized with serval languages, so, I use the function getLocalizedString(a, x) to get the localizedString "network" from Finder.app.

Here comes the problem. Some languages have no case-sensitive problem, like Chinese, Japanese. But in English, I get the string "network", and I can't go to the folder. "Network" works fine. Plz help!

Upvotes: 0

Views: 3608

Answers (4)

Masoud Saidmohammadi
Masoud Saidmohammadi

Reputation: 21

tell application "Finder"
    mount volume "smb://yournetworkfolderaddress/foldersname"
end tell

For example:

tell application "Finder"
    mount volume "smb://2TB._smb._tcp.local/Volume_1"
end tell

Upvotes: 2

Schuyler Colfax
Schuyler Colfax

Reputation: 1

I'm not sure if this helps.

To reveal the Network folder in a Finder window:

tell application "Finder" to reveal folder "Network" of computer container

To open the Network folder in a Finder window:

tell application "Finder" to open folder "Network" of computer container

Upvotes: 0

leleleo
leleleo

Reputation: 11

I got a solution .I use tell application "System Events" keystroke "k" using {shift down, command down} end tell to go to network folder and get the title of it.Then I get what I want.

Upvotes: 1

regulus6633
regulus6633

Reputation: 19030

I'm confused... the Network folder lists shared network resources that you can connect to. You don't "open" a network folder, you mount the volume and then open a folder on the mounted volume. I've never tried to open a folder in the Network folder. So I'm confused what you're trying to do.

In any case, regarding the localized string issue I'm not seeing it. First let me tell you that the Finder does not have a "localized string" command; it's an applescript command... so you should not be telling the Finder to get a localized string. Second, I'm english and when I get the localized string of "Network" it is capitalized so I'm not sure why you are getting a lower case "n".

set folderName to "Network"
localized string folderName --> "Network"

So I'm confused about a couple things you're doing. Sorry I couldn't be more help.

Upvotes: 0

Related Questions