PxPlus User Forum

Main Board => Discussions => Nomads => Topic started by: Jeffrey Ferreira on May 01, 2025, 02:01:26 PM

Title: Grid Images
Post by: Jeffrey Ferreira on May 01, 2025, 02:01:26 PM
Hi All,

a client asked there was a way when we are displaying our images in a grid for product options if there was a way they could right click on the option and copy it so that they could paste in an email to send to customers.

is this possible?

jeff
Title: Re: Grid Images
Post by: Mike King on May 01, 2025, 02:16:06 PM
Jeff

Do you want to copy the image or the text of product option?

Title: Re: Grid Images
Post by: Jeffrey Ferreira on May 01, 2025, 03:31:27 PM
Hi Mike,

the image if possible.

jeff
Title: Re: Grid Images
Post by: Jeffrey Ferreira on May 07, 2025, 11:57:00 AM
Hi Mike, so is there no way to copy the image that you know of
Title: Re: Grid Images
Post by: Mike King on May 07, 2025, 12:53:37 PM
Not directly but you should be able to detect/process the right click yourself and use a utility such as nircmd to copy the image file to the clipboard.  You can also use a powershell script to copy the image.
Title: Re: Grid Images
Post by: Jeffrey Ferreira on May 07, 2025, 03:17:19 PM
Hi Mike,
i found a three line powershell script.
it worked great. Exactly what we needed.
thanks again.
jeff
Title: Re: Grid Images
Post by: HendersonS on May 15, 2025, 08:35:37 AM
Hi Jeffrey, can you post the solution you found?
Title: Re: Grid Images
Post by: Mike King on May 20, 2025, 05:07:44 PM
Here is a simple program you can use to copy an image to the clipboard.  Simply set this program as the 'popup' processor for the grid cells for which you have the bitmap$ attribute set.

! Utility to copy image from Grid cell to clipboard
! Set the "popup" attribute of the image cell to perform this program
  local file$
  file$=pth(id'bitmap$,err=*next)
  if file$="" \
   then msgbox "Cannot copy";
        exit
  popup_menu "[Copy image=1001]",x
  if x<>1001 \
   then exit
  open (hfn)"|powershell.exe"
  x$="Add-Type -AssemblyName System.Windows.Forms;"
  x$+="Add-Type -AssemblyName System.Drawing;"
  x$+="[Windows.Forms.Clipboard]::SetImage($([System.Drawing.Image]::Fromfile("+quo+file$+quo+")));exit;"
  open (hfn)">powershell.exe"
  print (lfo)x$
  close (lfo)

NOTE: You would need to tweak the code a bit to work under WindX.  Basically you would need to copy the file from the server to a scratch file on the workstation and pass that workfile name to powershell.
Title: Re: Grid Images
Post by: Jeffrey Ferreira on August 18, 2025, 09:24:14 AM
Hi HendersonS,

I used to get notified when i was on a thread and someone replied to it. I'm not sure what i changed in my settings.  I know Mike already replied but here was my call program where you pass in the Image Path

27000 ! ^1000
27010 COPY_IMAGE_TO_CLIPBOARD:
27020 ! This was originally Needed so Internal/External Users could right click and copy pictures to send to their customers.
27030 ! The Powershell Script was found on line.
27040 ! Mike King (5/8/2025) said that there was not a way to copy an image in Pxplus at this time.
27050 enter (IMAGE_PATH$)
27060 if nul(IMAGE_PATH$) then goto *end
27070 call "CAIREPOS;CREATE_TEMP_FILE",POWERSHELL_SCRIPT$,".ps1" ! This just creates a blank text file with a Unique Name
27080 let POWERSHELL_SCRIPT=unt; open lock (POWERSHELL_SCRIPT)POWERSHELL_SCRIPT$
27090 print (POWERSHELL_SCRIPT)"Add-Type -AssemblyName System.Drawing, System.Windows.Forms"
27100 print (POWERSHELL_SCRIPT)"$bitmap = New-Object System.Drawing.Bitmap("+quo+IMAGE_PATH$+quo+")"
27110 print (POWERSHELL_SCRIPT)"[System.Windows.Forms.Clipboard]::SetImage($bitmap)"
27120 close (POWERSHELL_SCRIPT)
27130 let CMD$="^powershell.exe -ExecutionPolicy Bypass -File "+quo+POWERSHELL_SCRIPT$+quo
27140 call "MCSYSC",CMD$ ! This internal program executes the powershell script
27990 exit