Hi...
I'm trying to call a function in an automation called ImageMagick. The function has the following signature:
[VARIANT Convert :=] ImageMagick.Convert(VAR SAFEARRAY pArrayVar)
How do I pass the parameter "VAR SAFEARRAY pArrayVar" from C/AL? Which C/AL datatype am I supposed to pass? As far as I can figure from a Visual Basic code sample it is a function, which takes a variable number of arguments of type string.
/Stefan
0
Comments
What happend?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The following code...
CREATE(ImageMagick);
TextArray[1] := 'logo:';
TextArray[2] := '-format';
TextArray[3] := '10,20,30';
TextArray[4] := 'logo.jpg';
ImageMagick.Convert(TextArray);
...produces a runtime error: "The array dimensions must be identical".
ImageMagick is the automation and TextArray is a text array with dimensions 4. I have tried different array dimensions.
The following VB code seems to be working:
Set img = CreateObject("ImageMagickObject.MagickImage.1")
msgs = img.Convert("logo:","-format","%m,%h,%w","logo.jpg")
One idea is to pass the array using the Variant datatype, but anyone who knows how I do that? The following code does not work:
CREATE(ImageMagick);
TextArray[1] := 'logo:';
TextArray[2] := '-format';
TextArray[3] := '10,20,30';
TextArray[4] := 'logo.jpg';
VariantVar := TextArray;
ImageMagick.Convert(VariantVar);
It produces a runtime error: ":= cannot be performed on arrays. Choose a single array value using an expression such as: MyArray[...]".
/Stefan
If not, maybe you can try to find out what is the limit of the array in VB. For sure it is not "that unlimited". There must be some nice big number...
Write a code in VB and call the function each time with one parm more. (I don't know how exactly should this look like in VB)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
A maximum of 1 parameters must be used when calling the function. For example:
MyFunc( .. , .. , .. )
ROUND(MyVar)
ROUND(MyVar,0.05)
/Stefan
We need to import BMP to jpg or gif in NAvision.
I have got the same problem with convert function.
Is anybody knows where is answer? ](*,)
Yes we've had the same problem ...
The SAFEARRAY is used as a kind of variable argument list. Unfortunately, Navision cannot map SAFEARRAY types to one of its internal variables. (as stated in the Admin Guide)
We have programmed a tiny OCX, which works like a wrapper to other Automation Controllers. With this, you can invoke ImageMagick with the following Code:
See upload section (dbOleWrap) for the first Beta-release of this OCX. Please test and send me your comments.
In the hope, that it is helpful - Gunter