1. #1
    Senior Member Follow User Gallery
    Join Date
    Jul 2014
    Posts
    111

    Question Set subtool name

    I'm trying to figure out the syntax to rename a subtool. I guess you have to loop over the current subtools to get i's index before you can access it's existing name. And The re-naming part is what I'm stuck on.

    // Define a string
    [VarDef, s, "Gwen Stefani!"] // Why aren't all your subtools named after pop stars?
    [VarDef, subTName, ""]

    [VarSet, activeSubT,[SubToolGetActiveIndex]]

    [VarSet,totalSubTools,[SubToolGetCount]]

    [Loop,totalSubTools,
    [SubToolSelect,[Val,i]] //selects the subtool by number
    [VarSet,subTName,[IGetTitle,Tool:ItemInfo]] //gets the tool name

    [If, i == activeSubT,

    // Rename subtool???
    // [IPress,Tool:SubTool:Rename, s] // doesn't work
    [Set: Subtool.Name, s] // I have no idea I'm lost without dot notation
    ]
    ,i]

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    There's no 'official' way to rename a subtool but there's a hack. You create a file name with a '.dat' extension and then import it. The file doesn't need to exist.

    In your code you get the current subtool name. You don't need it in this instance but if you did you need to take off the end period that is in the name as it appears in the Item Info slider. I've added that in the code below:

    // Define a string
    [VarDef, s, "Gwen Stefani!"] // Why aren't all your subtools named after pop stars?
    [VarDef, subTName, ""]

    [VarSet, activeSubT,[SubToolGetActiveIndex]]

    [VarSet,totalSubTools,[SubToolGetCount]]

    [Loop,totalSubTools,
    [SubToolSelect,[Val,i]] //selects the subtool by number
    [VarSet,subTName,[IGetTitle,Tool:ItemInfo]] //gets the tool name
    [VarSet,subTName,[StrExtract,subTName,0,[StrLength,subTName]-2]]//this takes of the end period

    [If, i == activeSubT,
    [VarSet,newName,[StrMerge,[Var,s],".dat"]]//create a file name with .dat extension
    [FileNameSetNext,newName]
    [IPress,Tool:Import]//import the file - though it doesn't exist!
    ]
    ,i]

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Jul 2014
    Posts
    111

    Default

    Thanks... I think. That's a bit hacky :(

    I was expecting to pass a string to

    [IPress,Tool:SubTool:Rename]


    at least

  4. #4
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Well, it's a hack that's been in use a long time. And I can't give you methods that don't exist.

  5. #5
    Senior Member Follow User Gallery
    Join Date
    Jul 2014
    Posts
    111

    Default

    I've requested it to be added at a future date.
    "I've added this to our development tracker. I'll make sure to bring this up with the rest of the development team."

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •