How to get a PslTask, which is linked to one PslTransString?

Hello,

I'm currently trying, to create a macro, which searches a target string list for strings, which are linked to tasks.
I'd thought, I could do this by selecting each trans string in each trans list and then checking all tasks within the project against the current string with

If Task.Link = TransString Then

where "Task" is a PslTask and TransString is a PslTransString.

But, that doesn't work because of the error message "No property or method".

Unfortunately, I don't know, how to solve this and how to get a task, which is linked to a selected string.
At the end, I'd like to achieve, to delete a special task of a single string, if the task is already existing.

Thank you very much in advance for any hint, how to solve this.

If you have any further questions, please don't hesitate to let me know.

Best regards
Nils

emoji
  • Difficult question. What is your starting point? Are you looping the list of tasks or do you start with a PslTransString where .State(pslStateTask) = True?

    Another questions will be what "if the task already exist" means for you, having in mind that one PslTransString can have multiple tasks. So how to you calculate "already exists"?

    emoji
  • Hello ,

    thanks for your reply.

    My starting point - at the moment - is, to loop through the list of tasks, because I didn't found another possibility, to find a certain task which is linked to a certain string.

    The over all goal is, to add a task to a certain string, from a log file from running a review by pslcmd.exe. That should lead to the possibility, to run the review process automated at night time, create a log file and then be able to add tasks to all the strings, listed in the review log.

    If the line in the log file is something like: "([[string:88:3b702cb:1a11f2|88]]) String "Orion" in StringTable.NET "XYZ" Wrong usage of the term "Orion" - this term is defined as forbidden", a new task with comment "Wrong usage of the term "Orion" - this term is defined as forbidden" should be added to the string XYZ. If there's already a task added for this error and this string, the due date shell be changed.

    To reduce the amount of loopings I've created an array, which contains the title of the target list from the error message/log file (TrnListTitleArray). And additionally, I've created another array, which contains the string ID from the logfile (StringIDArray).

    My code looks like this, at the moment.

    For list = 0 To UBound(TrnListTitleArray)
    	For Each TransList In project.TransLists
    		If TransList.Title = TrnListTitleArray(list) Then
    			TransList.Open
    			For Each StringID In StringIDArray
    				Set TransString = TransList.FindID(StringID, 1)
    				If TransString.State(pslStateTask) = True Then
    					For Each tsk In project.Tasks
    						If tsk.Link Is TransString Then
    							project.Tasks.DueDate = Now + 7
    						End If
    					Next
    					i= i + 1
    				End If
    			Next
    			TransList.Close
    		End If
    	Next TransList
    Next list

    Currently, I'm not sure about, ho to find out, if a found task is really the task I've been searching for. My idea is, to compare the task comment from the existing task with the comment, which should be added from the current review log file.

    Btw., is there a way to "decode" the information "([[string:147:3b702cb:1a11f2|147]])" from the log file into which translation list the string is from? As far as I "know", "147" in this example is the number of the string. But how can one "decode", in which string list is this certain string? Is there a possibility, anyway? If so, it might be easier/faster to navigate to the certain string. Wouldn't it?

    Hopefully, it's now a litte more clear, what I like to achieve. If not, please don't hesitate to let me know.

    Best regards and have a nice day
    Nils

    emoji