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

Interface detection with JavaScript

Community Expert ,
Apr 29, 2025 Apr 29, 2025

Hi

 

With JavaScript, is there a way to detect whether the user is using the new Acrobat interface or the old one?
Context: I'd like to detect the interface for adding a menu item, i.e. in the Edit (or File) menu if it's the old interface, or in the Hamburger menu (which has been renamed AV2::HamburgerMenu) if it's the new one.

 

Also, what's the best way to detect whether it's the Mac or Windows version?

app.platform or other?
Because this menu change doesn't concern the Mac version.

 

Thank you


Acrobate du PDF, InDesigner et Photoshoptographe
TOPICS
How to , JavaScript , PDF
177
Translate
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
3 ACCEPTED SOLUTIONS
Community Expert ,
Apr 29, 2025 Apr 29, 2025

Yes there is!!

 

The new UI has a different menu structure, and the first item is the "Hamburger" Menu.

 

this line of code:

app.listMenuItems()[0].cName

 

In the Old UI returns "File".

In the New UI returns "AV2::HamburgerMenu".

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

This should cover all scenarios:

if(/AV2::HamburgerMenu/.test(app.listMenuItems()))
{
app.addMenuItem({
cName:"MyTestMenuItem", 
cParent:"AV2::HamburgerMenu",
cExec:"app.alert('');", 
nPos:0
})
}
else
{
app.addMenuItem({
cName:"MyTestMenuItem", 
cParent:"File", 
cExec:"app.alert('');", 
nPos:0
})
}

View solution in original post

Translate
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
Community Expert ,
Apr 30, 2025 Apr 30, 2025
LATEST

I hope they never remove the ability to revert to the old UI because this new one is an insult to productivity, flexibility, and common sense.

View solution in original post

Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

Yes there is!!

 

The new UI has a different menu structure, and the first item is the "Hamburger" Menu.

 

this line of code:

app.listMenuItems()[0].cName

 

In the Old UI returns "File".

In the New UI returns "AV2::HamburgerMenu".

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

Answered tool fast, you've already got that. So does the menu item method not work on the Mac?

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

Thanks for this line of code, I didn't know about this method.
In the Mac version the new UI has kept the File, Edit, View, etc. menus, so the problem doesn't arise.


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

Just tested on the Mac app.listMenuItems()[0].cName returns "Apple", the File menu is in 2nd position.

So I really need to test the platform too 😉


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

I'm at a loss then. So what's different on the Apple New UI?  Is there something else in the menus, or tool buttons?

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
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
Community Expert ,
Apr 29, 2025 Apr 29, 2025

This should cover all scenarios:

if(/AV2::HamburgerMenu/.test(app.listMenuItems()))
{
app.addMenuItem({
cName:"MyTestMenuItem", 
cParent:"AV2::HamburgerMenu",
cExec:"app.alert('');", 
nPos:0
})
}
else
{
app.addMenuItem({
cName:"MyTestMenuItem", 
cParent:"File", 
cExec:"app.alert('');", 
nPos:0
})
}
Translate
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
Community Expert ,
Apr 30, 2025 Apr 30, 2025
"Thom Parker

I'm at a loss then. So what's different on the Apple New UI?  Is there something else in the menus, or tool buttons?"

 

As you probably know, Apple's guidelines are strict, requiring a fixed menu bar (at the top of the screen) containing a set of menus with the same name in all applications.

In the "new experience" the menus have not changed and still contain the same items. What has changed is that the tool and navigation panels have been inverted (right/left) and the toolbar floats over the document. Leaving a large empty space above the document, as in the Windows version (I sincerely hope the “genius” who invented this will rots in hell for the rest of eternity 😉 ).

 

Capture_2504301448.pngexpand image


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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
Community Expert ,
Apr 30, 2025 Apr 30, 2025
LATEST

I hope they never remove the ability to revert to the old UI because this new one is an insult to productivity, flexibility, and common sense.

Translate
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
Community Expert ,
Apr 30, 2025 Apr 30, 2025
"PDF Automation Station This should cover all scenarios:"

 

Thanks, that's pretty much what I had in mind, I'll use your script.


Acrobate du PDF, InDesigner et Photoshoptographe
Translate
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