Monday, December 17, 2018

#1 2018-10-08 01:22:28 pm

Davo
Member
Registered: 2018-10-08
Posts: 2

Can't get current pane #-1728 from current pane

Running Sierra

tell application "System Preferences"
set myIds to the id of every pane
set myAnchors to anchors of current pane
end tell

Obviously new to applescript.

I'm getting the following error:

error "System Preferences got an error:  Can't get current pane." number -1728 from current pane.

Apologies for being able give a compiled script.
I'm in a secured environment.

Thank you in advance.

Model: mac mini
AppleScript: 2.5
Browser: Safari 537.36
Operating System: macOS 10.12


Filed under: , current pane, number -1728

Offline

 

#2 2018-10-08 01:56:20 pm

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4741

Re: Can't get current pane #-1728 from current pane

Hi. Welcome to MacScripter.

The current pane in System Preferences is the pane (eg. General, Mouse, Network) that's currently showing. It sounds as if you may not have a pane showing when you get the error. Is that the case?

MacScripter has its own [applescript] and [/applescript] tags for AppleScript code. If you put your code between these, or select it in the posting window and click the "Applescript" button just above, it comes out looking like this:

Applescript:

tell application "System Preferences"
   set myIds to the id of every pane
   set myAnchors to anchors of current pane
end tell


NG

Offline

 

#3 2018-10-08 02:23:55 pm

Davo
Member
Registered: 2018-10-08
Posts: 2

Re: Can't get current pane #-1728 from current pane

Ah I see. Yes, that works but my expectation was different.
I was expecting an output to the command line.
I'm trying to ascertain version information without going into the machine using Remote Desktop.
i.e., I'm using ssh trying to get Java versioning specifically.

Looking into the preferences Info.plist for Java, I see versioning information but it's not the same when the actual preference is opened.  I was hoping this would somehow resolve the disparity of the information.

Do you happen to know if this would be possible to do?

Thank you for resolving the other issue, esp. so quickly.

Offline

 

#4 2018-10-09 03:44:43 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4741

Re: Can't get current pane #-1728 from current pane

You lost me for a while. I couldn't work out what scripting System Preferences had to do with command lines, Remote Desktop, or Java.

I take it you want to quiz a remote machine which has a non-standard Java installation for which there's a pane in its System Preferences application ( menu -> System Preferences…).

System Preferences doesn't return any useful information via AppleScript beyond the names and identifiers of the panes and anchors. I don't know the answer to your query, but it may be worth checking out system_profiler if you haven't already done so. For instance, to get the Flash Player version on my machine:

Applescript:

set paneName to "Flash Player" -- Try changing this to the name of your Java preference pane.
do shell script "system_profiler SPPrefPaneDataType | sed -En '/" & paneName & ":/,/Version:/{/" & paneName & ":|Version:/p;}'"

However, I suspect that this returns the pane version, which just happens to coincide with that of the Flash Player. I get 1.7 for the Dock pane, but the Dock on this machine is version 1.8.

system_profiler can also return information about frameworks and other kinds of data.

I hope this has given you something useful to go on. Sorry I couldn't be more help.  sad


NG

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)