mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 8:59 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Mon Dec 22, 2008 1:54 pm 
Offline

Joined: Fri Sep 24, 2004 9:24 am
Posts: 5
Location: Europe
Country: Netherlands (nl)
Hi,

We're using the code below in form 30 (Item Card), and that works great.

Code: Select all
Path := 'C:\jpg\';        // might be defined in custom setup form and pointing to shared drive
WindowsStyle := 0;        // do not show cmd window
WaitForCommand := TRUE;   // wait for command to finish

SETRANGE("No.");     

IF EXISTS (Path+"No."+'.jpg') THEN
BEGIN
    CREATE(WShell);
    Cmd := Path+'jpg2bmp\jpg2bmp.exe -outfile '+Path+'temp.bmp -color 256 -bmp '+Path+"No."+'.jpg';
    WShell.Run(Cmd,WindowsStyle,WaitForCommand);
    CLEAR(WShell);
    Picture.IMPORT(Path+'temp.bmp',FALSE);
END
ELSE BEGIN
  CLEAR(Picture);
END;


We only encounter one strange problem. If a user keeps pressing the navigate buttons (Back or Forward) in the toolbar, a Navision messagebox pops up stating "Do you want to change the name of the record? (Yes - No)". This occurs just before a record that contains a picture is displayed. The result is that the previous item now shows the image which is wrong.
So what might be the problem regarding the messagebox and showing the image one record to early?

Hope someone has an answer.

Nico Dekker
The Netherlands


Top
 Profile  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Mon Dec 22, 2008 7:04 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
So you showing the pic right on the item card & not using Item Picture form 346.

Which trigger to you have the code on? if I get a second I'll try your code and see what my results are.

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re:
PostPosted: Thu Nov 26, 2009 9:39 am 
Offline

Joined: Tue Sep 16, 2008 6:46 pm
Posts: 22
Location: Delhi
Country: India (in)
Tomas wrote:
Code: Select all
Path := 'C:\jpg\';        // might be defined in custom setup form and pointing to shared drive
WindowsStyle := 0;        // do not show cmd window
WaitForCommand := TRUE;   // wait for command to finish

SETRANGE("No.");     

IF EXISTS (Path+"No."+'.jpg') THEN
BEGIN
    CREATE(WShell);
    Cmd := Path+'jpg2bmp\jpg2bmp.exe -outfile '+Path+'temp.bmp -color 256 -bmp '+Path+"No."+'.jpg';
    WShell.Run(Cmd,WindowsStyle,WaitForCommand);
    CLEAR(WShell);
    Picture.IMPORT(Path+'temp.bmp',FALSE);
END
ELSE BEGIN
  CLEAR(Picture);
END;


The only issue left is that if we put images (and jpg2bmp.exe) on a shared drive, everytime we'll display image, we'll have to cofirm that we trust that program.

Otherwise, thanks Savatage and kriki for a wonderful tip! \:D/




When i run this function then i found ole error

---------------------------
Microsoft Dynamics NAV
---------------------------
This message is for C/AL programmers:

An exception was raised in method Run. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.

---------------------------
OK
---------------------------
now what i do

Thank's !!!
Devendra


Top
 Profile  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Mon Nov 30, 2009 7:03 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
Wshell->Datatype=Automation->Subtype = Windows Script Host Object Model->WshShell
Cmd = Integer
WindowsStyle = Integer
WaitForCommand = Boolean

What do you have these declared as?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Sun Apr 04, 2010 12:09 pm 
Offline

Joined: Wed Feb 11, 2009 7:45 pm
Posts: 5
I declared

Cmd = Text 250 and it works :)

Further I did generated temp.bmp in user level temp folder to avoid multi user conflict (Here the jpg name was based on "Design No." and there were multiple item with same design no. )

- Rajesh Asar


Top
 Profile E-mail  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Sun Apr 04, 2010 11:10 pm 
Offline

Joined: Tue May 06, 2008 2:56 pm
Posts: 350
Location: Walton-On-Thames
Country: United Kingdom (uk)
When I did this I used IrfanView, it can convert and resize a lot of different image formats from the command line.

_________________
Robert de Bath
TVision Technology Ltd


Top
 Profile  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Thu May 12, 2011 12:20 am 
Offline

Joined: Tue Oct 26, 2010 8:05 am
Posts: 2
Country: United States (us)
When I run this function I also get following error message.
An exception was raised in method Run. The OLE control or Automation Server has returned error (HERSULT) -2147352567.

Can anyone please help.


Top
 Profile E-mail  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Thu May 12, 2011 1:18 am 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
rajeshasar wrote:
I declared

Cmd = Text 250 and it works :)

Further I did generated temp.bmp in user level temp folder to avoid multi user conflict (Here the jpg name was based on "Design No." and there were multiple item with same design no. )

- Rajesh Asar

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Sun Mar 10, 2013 4:58 am 
Offline

Joined: Sun Mar 10, 2013 4:45 am
Posts: 1
Country: Nepal (np)
Dear all,

I have tried this technique to import the jpg file but the problem is the photo is not converted. i have taken "cmd" variable as text 250 because whenever i choose the datatype of this variable as integer, the error appears for the datatype "integer := text". the photo i have chosen is not converted to bmp. please suggest me where am i wrong??

Path := 'D:\';
WindowsStyle := 0;
WaitForCommand := TRUE;

SETRANGE("No.");
IF EXISTS (Path+"No."+'.jpg') THEN
BEGIN
CREATE(Wshell);

cmd := Path+'jpg2bmp\jpg2bmp.exe -outfile'+Path+"No."+'.bmp -color 256 -bmp'+Path+ "No."+'.jpg';

Wshell.Run(cmd,WindowsStyle,WaitForCommand);
CLEAR(Wshell);
Photo.IMPORT(Path+"No."+'.bmp',FALSE);
END
ELSE BEGIN
CLEAR(Photo);
END;


Top
 Profile E-mail  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Sun Mar 10, 2013 5:19 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6978
Location: L.I., New York
Country: United States (us)
is you executable in D:\jpg2bmp\jpg2bmp.exe?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Import JPG on Fly & Show In Navision
PostPosted: Mon Mar 11, 2013 9:42 am 
Offline

Joined: Tue May 06, 2008 2:56 pm
Posts: 350
Location: Walton-On-Thames
Country: United Kingdom (uk)
Suman Maharjan wrote:
cmd := Path+'jpg2bmp\jpg2bmp.exe -outfile'+Path+"No."+'.bmp -color 256 -bmp'+Path+ "No."+'.jpg';
:bug:

Looks like you're missing the spaces, you do have to be precise for this to work.

You can use a MESSAGE to popup the cmd that's being used and copy&paste that into a cmd shell to check.

_________________
Robert de Bath
TVision Technology Ltd


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: