![]() |
#1
|
|||
|
|||
![]()
Hello All
Just got Draw V12 and have been trying out my earlier V11 macros. Some are failing, in particular this relatively simple one. I can't work out why my Replace Objects macro (a clone of Alex's Object Replacer CorelScript) is failing. If I single step through it (I set a break point at the start of the main For loop), it works, if I just run it fails to replace the object based on the form settings and move it to the originals location. Could somebody help me get on the right track? Link to the macro is in my sig at the bottom of this message Thanks for any assistance Peter |
#2
|
||||
|
||||
![]()
Peter,
There is an issue with using ShapeRange and Selection objects which do not properly update their bounding box (position/size). Well, it all results in that you need to explicitly create a selection out of shape range before you get or set its size/position. In your particular case, you need to add "nsr.CreateSelection" right after you aquired it through ActiveSelectionRange. The selection bounding box is updated when the obejcts are drawn on the screen, that's why you macro works correctly when you debug through it. The shapes have a chance to refresh themselves when you step through the code however they don't if you run the macro in a single shot. Also it seems that BeginCommandGroup/EndCommandGroup screw up things badly for some reason. Disabling this makes the macro run correctly (after the CreateSelection hack). I'm not sure why this happens though. |
#3
|
|||
|
|||
![]()
Alex
Many thanks. I like it when its an SEP (someone elses problem) :wink: Also explains the failure of some of my other macros. At least I know what to lookout for. Thanks again Peter |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|