Skip to main content
18-Opal
May 30, 2019
Solved

create a toolbar button to a pdf

  • May 30, 2019
  • 1 reply
  • 3573 views

Good afternoon, I am looking for guidance on how to create a toolbar button in editor that when pressed will open  specific pdf. How do I do this?

 

Bryon

Best answer by GarethOakes

Bryon, it turns out execute() is not the command, see if the following works for you?

sh cmd /c start "" "c:\\src\\test test.pdf"

 

Once you get that command working then you will need to see how to add a toolbar button, so get that much working first with a test PDF.

1 reply

16-Pearl
May 30, 2019

I haven't done this type of thing for a while but it should only take you an hour or so to figure out:

1. You will want to "shell out" or exec the following: start "" "c:\my\path\file.pdf" (if you type that command in to Windows command prompt it should open the PDF)

2. Figure out the ACL command for shelling out to command line, perhaps it is exec? Just look it up in the ACL command reference. You can test your full command from the ACL command line that is enabled in the Arbortext preferences. It may be something like (not tested): exec("start \"\" \"c:\\my\\path\\file.pdf\"")

3. Figure out how to add a toolbar button. It should be documented. For menus there is a menuloadhook you attach your code to, perhaps there is a toolbarloadhook too? The toolbar button then calls the ACL command you tested working at step #2.

bfriesen18-OpalAuthor
18-Opal
May 31, 2019

Thanks Gareth, this is a whole new world for me.

I have successfully got my pdf to open at the windows command line.

start "c:\test.pdf"

 

I then searched the ACL ref guide (https://www.ptc.com/support/-/media/F0978608A44A4E7493ED9572BE7590C7.pdf?sc_lang=en) for exec, but it does not come up but execute does. In editor I tried

exec("start \"\" \"c:\\test.pdf\"") and execute("start \"\" \"c:\\test.pdf\"")

for exec I get and unrecognized function call error and it repeats the code I entered.

 

Thanks

Bryon

 

 

16-Pearl
June 2, 2019

Bryon, it turns out execute() is not the command, see if the following works for you?

sh cmd /c start "" "c:\\src\\test test.pdf"

 

Once you get that command working then you will need to see how to add a toolbar button, so get that much working first with a test PDF.