Hello,
A very simple macro ; runs fine if alone. A lot of strain if imbricated in a little more complex one which I have simplified for this post.
simple macro= after a cursor rectangular selection crop image selection "CTRLY"
little more complex macro=Dialogbox in which I can choose the simple one
Dialog>Dialog1
Caption=.. ..
Width=220
Height=510
Top=75
Left=675
ListBox=msListBox1,16,10,180,400,CTRLY%CRLF%C-V-LOZERE,true
EndDialog>Dialog1
RGB>250,50,50,aColor
SetDialogObjectFont>Dialog1,msListBox1,Ariel,8,1,aColor
GetActiveWindow>title,x,y
Show>Dialog1
/// DéclicLoop detects left mouse click
let>a=1
Label>DéclicLoop
LibFunc>user32,GetAsyncKeyState,keystate,1
wait>0.1
If>keystate0
wait>0.1
let>a=a+1
endif
if>a=2,Déclic
Goto>DéclicLoop
wait>0.05
Label>Déclic
GetDialogAction>Dialog1,r
SetFocus>title
wait>0.05
if>%Dialog1.msListBox1%=CTRLY,ctrly
Label>autre
send>%DIALOG1.MSLISTBOX1%
wait>0.05
goto>Exit
/// crop image selection "CTRLY"
Label>ctrly
Wait>0.56
CloseDialog>Dialog1
Setfocus>title
Wait>0.56
Press LCTRL
Wait>0.56
Send>y
Wait>2
Release LCTRL
Label>Exit