Skip to main content
18-Opal
July 31, 2020
Solved

menu to queue print jobs, need help modifing menu link

  • July 31, 2020
  • 1 reply
  • 4482 views

Trying to add the set preference to my queue menu, but it does not seem to work. Looking for some guidance in ACL.

 

# create menu
if (!menu_exists('.Window')) {
return;
}

if ( !menu_exists( '.Queue.' ) ) {

menu_add -menu .Window "Queue";

menu_add "Queue." ""Long" cmd "set -preference petransactionoptions = \"queueID:long\""";
menu_add "Queue." ""Short" cmd "set -preference petransactionoptions = \"queueID:short\""";
menu_add "Queue." ""None" cmd "set -preference petransactionoptions = \"queue:yes\""";

}


} # _addmenu()

 

Thanks 

 

BRyon

Best answer by GarethOakes

I'm a bit rusty myself but I think you are almost there. If it were me I'd simplify it down a little at least for initial testing to get it working? I added my version of this code at the bottom. I used the Help Center as a reference, I haven't tested this in Arbortext yet. BTW, in case you didn't know already you can use the response() command to test out if the -cmd is being called correctly. It will popup a dialog so you can see what it is about to do.

 

https://support.ptc.com/cs/help/arbortext_hc/ae61_hc/aeAcl/help9122.html

 

function addQueueMenu() {
  if ( !menu_exists( ".Queue." ) ) {

    menu_add -menu .Window "Queue";

    menu_add .Queue. "Long" -cmd {set -preference petransactionoptions = "queueID:long"};
    menu_add .Queue. "Short" -cmd {set -preference petransactionoptions = "queueID:short"};
    menu_add .Queue. "None" -cmd {set -preference petransactionoptions = "queue:yes"};

  }
}

add_hook("menuloadhook", "addQueueMenu");

1 reply

16-Pearl
August 3, 2020

Hi Bryon,

 

This is actually covered in the Arbortext Help Center but long story short you need to use menuloadhook() - see here: https://support.ptc.com/cs/help/arbortext_hc/ae61_hc/aeAcl/help796.html?queryId=173b1b3f891#ATI.759

 

-Gareth

bfriesen18-OpalAuthor
18-Opal
August 4, 2020

Thanks for the info Gareth, I am not an ACL kind of guy, more of a hack and slash... or copy and paste...

 

Something like this?

 

function _addmenu() {

 

if ( !menu_exists( '.Queue.' ) ) {

menu_add -menu .Window "Queue";

menu_add "Queue." ""Long" cmd "set -preference petransactionoptions = \"queueID:long\""";
menu_add "Queue." ""Short" cmd "set -preference petransactionoptions = \"queueID:short\""";
menu_add "Queue." ""None" cmd "set -preference petransactionoptions = \"queue:yes\""";

}


} # _addmenu()

 

# function: _menuloadhook()

function _menuloadhook(win,menupath) {
_addmenu();
} # _menuloadhook()

 

 

# function: _addhook()
function _addhook() {
add_hook('menuloadhook',package_name()."::_menuloadhook");
} # _addhook()

 

Thanks,

Bryon

 

16-Pearl
August 4, 2020

I'm a bit rusty myself but I think you are almost there. If it were me I'd simplify it down a little at least for initial testing to get it working? I added my version of this code at the bottom. I used the Help Center as a reference, I haven't tested this in Arbortext yet. BTW, in case you didn't know already you can use the response() command to test out if the -cmd is being called correctly. It will popup a dialog so you can see what it is about to do.

 

https://support.ptc.com/cs/help/arbortext_hc/ae61_hc/aeAcl/help9122.html

 

function addQueueMenu() {
  if ( !menu_exists( ".Queue." ) ) {

    menu_add -menu .Window "Queue";

    menu_add .Queue. "Long" -cmd {set -preference petransactionoptions = "queueID:long"};
    menu_add .Queue. "Short" -cmd {set -preference petransactionoptions = "queueID:short"};
    menu_add .Queue. "None" -cmd {set -preference petransactionoptions = "queue:yes"};

  }
}

add_hook("menuloadhook", "addQueueMenu");