XMLParse Item Name?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

XMLParse Item Name?

Post by Phil Pendlebury » Thu Nov 01, 2018 10:08 am

Is there a way to refer to an item by its actual name?

The parse below works but I have to have a number (mnum) assigned.

Code: Select all

XMLParse>strXML,/KeyCommandsPreset/member[@name='Preset']/list[@name='Macros']/item[%mnum%]/list[@name='Commands']/item,cres,NNumItems
However, since I already know the name of that item in var %macroname%, can I use that instead? I have tried using:

Code: Select all

item[@name=%macroname%]
and a few permutations of that but no luck.
Phil Pendlebury - Linktree

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: XMLParse Item Name?

Post by Marcus Tettmar » Fri Nov 02, 2018 4:06 pm

I see you're using that @name= syntax in other places so I guess it should work. However, looks like it might want apostrophes:

item[@name='%macroname%']
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: XMLParse Item Name?

Post by Phil Pendlebury » Sat Nov 03, 2018 11:07 am

Thanks Marcus, this kind of works (I had tried that before) but for some reason it reports all the items from all the Macros section instead of just the one I need.

I know this is tricky stuff without having the XMl file to look at. I'll plug away and see if I can come up with a solution before asking for further help.

Thanks again,

:-)
Phil Pendlebury - Linktree

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: XMLParse Item Name?

Post by Phil Pendlebury » Sat Nov 03, 2018 1:31 pm

Ok solved this by using:

Code: Select all

GetDialogProperty>Dialog1,MSComboBox1,ItemIndex,macronumber

Code: Select all

XMLParse>strXML,/KeyCommandsPreset/member[@name='Preset']/list[@name='Macros']/item[%macronumber%]/list[@name='Commands']/item,cres,NNumItems
Phil Pendlebury - Linktree

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts