getComment/setComment JEB script

21 views
Skip to first unread message

Axelle Apvrille

unread,
Mar 19, 2021, 8:46:05 AMMar 19
to JEB Decompiler

Hi,
One of my scripts sets comments next to a given selected line. This used to work in JEB3, but no longer does with JEB4.

This is the error I get - so getComment() no longer exists for the unit.

```
  File "/jeb4/scripts/AlienDecrypt.py", line 75, in run
    comment0 = f.getUnit().getComment(a)
AttributeError: 'com.pnfsoftware.jebglobal.wF' object has no attribute 'getComment'
```

And my code :

```
       a = f.getActiveAddress()
        if a and isinstance(f.getUnit(), IInteractiveUnit):
            comment0 = f.getUnit().getComment(a)
            comment = decrypted_string + '\n' + comment0 if comment0 else decrypted_string
            f.getUnit().setComment(a, comment)
```

How am I meant to get/set comments now?

Thanks

-- Axelle

Cedric Lucas

unread,
Mar 19, 2021, 9:37:00 AMMar 19
to JEB Decompiler
Hi,

You can use getFullComment/setPrimaryComment from now, or better use the CommentManager.

Regards

Cedric

Axelle Apvrille

unread,
Mar 22, 2021, 3:38:34 AMMar 22
to JEB Decompiler
Thanks this works fine :)
-- Axelle
Reply all
Reply to author
Forward
0 new messages