• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

getPrefAsBool seems to hooked up to computerSaysNo.exe

Engaged ,
Oct 11, 2022 Oct 11, 2022

Copy link to clipboard

Copied

The extendscript function

 

 

app.preferences.getPrefAsBool()

 

 

always returns false. Here's a demo, comparing it to getPrefAsLong, which seems to work:

 

 

app.preferences.getPrefAsLong("Main Pref Section v2", "Pref_SEQUENCE_ZEROS", PREFType.PREF_Type_MACHINE_SPECIFIC)
> 5
// returns 5 which should be truthy, but
app.preferences.getPrefAsBool("Main Pref Section v2", "Pref_SEQUENCE_ZEROS", PREFType.PREF_Type_MACHINE_SPECIFIC)
> false
//returns wrong answer

app.preferences.getPrefAsLong("Main Pref Section v2", "Pref_HIDE_LOCKED_MASKS", PREFType.PREF_Type_MACHINE_SPECIFIC)
> 0
// returns 0, should be falsy
app.preferences.getPrefAsBool("Main Pref Section v2", "Pref_HIDE_LOCKED_MASKS", PREFType.PREF_Type_MACHINE_SPECIFIC)
> false
//returns false, so it's not just inverting the answer

app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY")
> 1
//returns 1. Note, using "Main Pref Section" and no PREFTYPE enum
app.preferences.getPrefAsBool("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY")
> After Effects error: The section name and key (Main Pref Section, Pref_SCRIPTING_FILE_NETWORK_SECURITY) could not be found in the preferences.
// throws an error
app.preferences.getPrefAsBool("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY", PREFType.PREF_Type_MACHINE_SPECIFIC)
> After Effects error: The section name and key (Main Pref Section, Pref_SCRIPTING_FILE_NETWORK_SECURITY) could not be found in the preferences.
// tried with the preftype specified, still not found
app.preferences.getPrefAsBool("Main Pref Section v2", "Pref_SCRIPTING_FILE_NETWORK_SECURITY", PREFType.PREF_Type_MACHINE_SPECIFIC)
> false
// returns false, so it found the pref, but reported it wrong.

 

Bug Investigating
TOPICS
Scripting , SDK

Views

83

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Pinned Reply

Adobe Employee , Feb 23, 2023 Feb 23, 2023

Hi @stib,

Thank you for reporting this issue. There does appear to be a lot of inconsistency with the getPref... methods, so we'll be opening a bug to investigate possible fixes. This may end up being a breaking change to existing scripts, so we'll have to tread lightly. I'll attempt to better document what I found in a short investigation below.

 

In a nutshell, you can only access a given preference as a bool if the preference is of that type, which you can determine by looking at the preferen

...
Status Investigating

Votes

Translate

Translate
1 Comment
Adobe Employee ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

LATEST

Hi @stib,

Thank you for reporting this issue. There does appear to be a lot of inconsistency with the getPref... methods, so we'll be opening a bug to investigate possible fixes. This may end up being a breaking change to existing scripts, so we'll have to tread lightly. I'll attempt to better document what I found in a short investigation below.

 

In a nutshell, you can only access a given preference as a bool if the preference is of that type, which you can determine by looking at the preference .txt files. To explain further:

 

All preferences for After Effects are stored as strings in the .txt preference files. Within those files, the formatting determines their true data type as a boolean, long, etc. The getPref... methods perform coercion in some cases but not others, which leads to inconsistent behavior. To avoid this, look in the various .txt preference files for the preference you want to access and call the appropriate getter/setter method.

 

Here is a quick map of what each type looks like:

 

// This is a float, note the decimal point
"Speed" = "83.500000"

// This is a string
"Label Text ID 2 # 1" = "Red"

// This is a long, note the quotes
"Pref_SCRIPTING_FILE_NETWORK_SECURITY" = "1"

// This is a bool, without any quotes
"Enable Queue Notifications" = 00
 

 

 

There are other types in the preferences as well that do not correspond to these four types, but I need to dig in a bit more to see which method would be appropriate for them. I also noticed that calling the wrong method on some properties will wipe them out, which is a different bug that we'll also be investigating. 

 

Thanks again for reporting this issue,

- John, After Effects Engineering Team 

Status Investigating

Votes

Translate

Translate

Report

Report