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

UXP (IDJS) LocalStorage usage

New Here ,
Nov 01, 2022 Nov 01, 2022

Copy link to clipboard

Copied

Hi everyone,

 

I'm tinkering around with the new UXP javascript in InDesign and would like to store a value in LocalStorage. But I can't seem to get a value saved to storage.

 

Here is my code:

 

main();

function main() {
    console.log('Main function entered.');

    window.localStorage.setItem('myKey', 'myValue');

    console.log(window.localStorage.getItem('myKey'));
}

Code is in /Users/<my-username>/Library/Preferences/Adobe InDesign/Version 18.0/de_DE/Scripts/Scripts Panel/my-scripts/localStorage.idjs

 

I'm tailing the log files in Terminal from /Users/<my-username>/Library/Caches/UXPLogs to see the console.log() output. The first log entry shows Main function entered. but the second one is null.

 

Am I missing something?

 

My InDesign version is 18.0 on OSX 12.6.1

TOPICS
UXP Scripting

Views

589
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 Correct answer

Adobe Employee , Nov 04, 2022 Nov 04, 2022

@amandahuang says:

 

scripts don’t have access to window.localStorage

 

UXP plugins for InDesign are expected next year.

Votes

Translate
Adobe Employee ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

Hi Daniel,

 

Something is buggy about the forum script tag "UXP Scripting" at the moment, but I did put this in front of the InDesign team. You might want to also search https://forums.creativeclouddeveloper.com/ for local storage...

Votes

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
Adobe Employee ,
Nov 04, 2022 Nov 04, 2022

Copy link to clipboard

Copied

@amandahuang says:

 

scripts don’t have access to window.localStorage

 

UXP plugins for InDesign are expected next year.

Votes

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
Adobe Employee ,
Nov 04, 2022 Nov 04, 2022

Copy link to clipboard

Copied

LATEST

As Erin said, scripts don't have access to persistent storage options including `window.localStorage`. This is because each script has its own execution context that is destroyed when the script is finished executing. Once we roll out UXP plugins for InDesign, that will be available.

Votes

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