Re: CONVERT PICTURE v17

2019-03-09 Thread Charles Miller via 4D_Tech
You need to do convert in 32 bit and make sure to take care of transparency
Chuck

On Sat, Mar 9, 2019 at 2:17 PM Wayne Stewart via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Are you running the code in 32 bit mode on a computer with QuickTime
> installed?
>
> On Sat, 9 Mar 2019 at 19:27, David Garrard via 4D_Tech <
> 4d_tech@lists.4d.com>
> wrote:
>
> > I have some legacy pictures fields with .PICT pictures in them in my
> > Windows database that I am converting to v17 64 bit.  Here is my code to
> > convert the pictures to JPG format.
> >
> > ALL RECORDS([DOCC_Document])
> > For ($i;1;Records in selection([DOCC_Document]))
> > GOTO SELECTED RECORD([DOCC_Document];$i)
> > GET PICTURE FORMATS([DOCC_Document]Document_Icon;$aTPictureFormats)
> > CONVERT PICTURE([DOCC_Document]Document_Icon;".jpg")
> > SAVE RECORD([DOCC_Document])
> > End for
> >
> > The documentation suggests that this would convert the pictures in the
> > database to jpg format and they would lose the "ugly big cross on PICT"
> > replacement icon.  But I see no changes.
> >
> > I must be doing something fundamentally wrong... Any ideas?
> >
> > David Garrard
> > **
> > 4D Internet Users Group (4D iNUG)
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **
>
> --
>
> Regards,
>
> Wayne
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

-- 
-
 Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
 Informed Solutions, Inc.
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D, Sybase & SQL Server connectivity
  http://www.informed-solutions.com
-
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law.  These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited.  Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Dropbox Upload and Dropbox Download Methods

2019-03-09 Thread Douglas von Roeder via 4D_Tech
Tim:

Agree with Kirk — thanks for posting this!

--
Douglas von Roeder
949-336-2902


On Fri, Mar 8, 2019 at 6:12 PM Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Tim,
> Thanks for sharing this.
>
> On Fri, Mar 8, 2019 at 3:55 PM Tim Nevels via 4D_Tech <
> 4d_tech@lists.4d.com>
> wrote:
>
> > A few weeks ago I posted a message asking if anyone had written code to
> > upload and download files to Dropbox. Got no responses other than “the
> API
> > looks like it is easy to do”.
> >
> > Today I spent time writing a couple of methods to allow uploading and
> > downloading files from Dropbox with native 4D commands using the Dropbox
> v2
> > API. And people were right, it was not too difficult. The v2 API is
> > implemented very nicely and documented fairly well. I found a few
> > documentation errors, but they were easily dealt with.
> >
> > 4D v17 provided all the commands needed to make it all work with very
> > little code. Doing this with NTK would easily take 3 times the amount of
> > code.
> >
> > My current needs are very simple. I want to upload a file to Dropbox and
> > replace any existing file if necessary. Dropbox maximum file size for a
> > single upload operation is 150MB. That’s more than enough for my needs.
> But
> > if you want to upload larger files — up to the Dropbox API max size of
> > 350MB — you’ll have to implement an “upload session”.
> >
> > Download requirements are also simple. Just download a file from a
> Dropbox
> > path to a path on your hard drive. Dropbox paths are in POSIX format.
> >
> > The Dropbox v2 API uses OAuth 2, but that basically boils down to
> creating
> > an “App” and getting an “access token” the you use with all the API
> calls.
> > I’ll leave it up to you to go read the docs and set that all up. It’s
> easy.
> >
> > The code uses dot notation, but with a little work it could be ported to
> > work with older versions for 4D probably back to v14. Code is
> > cross-platform without any extra effort needed.
> >
> > Here is me giving back to the group so you don’t have to spend a day
> > developing and testing code. If others implement more of the Dropbox v2
> > API, please post it to the iNUG to help others.
> >
> >   // ===
> >   // PROJECT METHOD: Dropbox_UploadFile
> >
> >   // PARAMETERS: $0 = results object
> >   // $1 = dropbox access token
> >   // $2 = dropbox path
> >   // $3 = file path
> >
> >   // DESCRIPTION: Uploads a file to Dropbox using the v2 API
> >   // Max upload size in a single transfer is 150MB.
> >
> >   // https://www.dropbox.com/developers/documentation/http/documentation
> >
> >   // CREATED BY: Tim Nevels, Innovative Solutions ©2019
> >   // DATE: 3/8/19
> >   // LAST MODIFIED:
> >   // 
> >
> > C_OBJECT($0;$results_o)
> > C_TEXT($1;$dropboxAccessToken_t)
> > C_TEXT($2;$dropboxPath_t)
> > C_TEXT($3;$filePath_t)
> > $dropboxAccessToken_t:=$1
> > $dropboxPath_t:=$2
> > $filePath_t:=$3
> >
> >   // declare local variables
> > C_TEXT($headerValue_t;$requestURL_t;$response_t)
> > C_LONGINT($statusCode_l)
> > C_BLOB($content_x)
> > C_OBJECT($headerValue_o;$response_o)
> > ARRAY TEXT($headerName_at;0)
> > ARRAY TEXT($headerValue_at;0)
> >
> >   // setup http header
> > APPEND TO ARRAY($headerName_at;"Authorization")
> > APPEND TO ARRAY($headerValue_at;"Bearer "+$dropboxAccessToken_t)
> >
> >   // set upload header values
> > APPEND TO ARRAY($headerName_at;"Content-Type")
> > APPEND TO ARRAY($headerValue_at;"application/octet-stream”)
> >
> > APPEND TO ARRAY($headerName_at;"Dropbox-API-Arg")
> > $headerValue_o:=New object(\
> > "path";$dropboxPath_t;\
> > "mode";"add";\
> > "autorename";False)  // overwrite any existing file
> > $headerValue_t:=JSON Stringify($headerValue_o)
> > APPEND TO ARRAY($headerValue_at;$headerValue_t)
> >
> >   // set url
> > $requestURL_t:="https://content.dropboxapi.com/2/files/upload;
> >
> >   // load the file
> > DOCUMENT TO BLOB($filePath_t;$content_x)
> >
> >   // check file size
> > If (BLOB size($content_x)>(1024*1024*149))  // over 149MB, too close to
> > limit to try
> > $results_o:=New object(\
> > "success";False;\
> > "statusCode";408;\
> > "errorMessage";"File is to large to upload in one piece")
> > Else
> >   // upload the file
> > HTTP SET OPTION(HTTP compression;1)  // do compression
> > HTTP SET OPTION(HTTP timeout;60*10)  // 10 minute timeout
> > $statusCode_l:=HTTP Request(HTTP POST
> >
> method;$requestURL_t;$content_x;$response_t;$headerName_at;$headerValue_at)
> >
> >   // build results object
> > Case of
> > : ($statusCode_l=200)  // upload was a success
> > $results_o:=New object(\
> > "success";True;\
> > "statusCode";$statusCode_l;\
> > "errorMessage";"File upload was successful")
> >
> > : 

Re: Help LEP macOS to open the Emoji viewer

2019-03-09 Thread Keisuke Miyako via 4D_Tech
P.S.

to post keystrokes programmatically

https://github.com/miyako/4d-plugin-virtual-key

to do it the proper way (it seems, not tested)

https://developer.apple.com/documentation/appkit/nsapplication/1428455-orderfrontcharacterpalette?language=objc



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Help LEP macOS to open the Emoji viewer

2019-03-09 Thread Keisuke Miyako via 4D_Tech
which version of macOS?

the code is not allowed in Terminal on Mojave;

osascript is not allowed to send keystrokes (1002)

https://www.reddit.com/r/MacOS/comments/9lwlsv/script_editor_not_allowed_to_send_keystrokes/

on top of that, to grant automation to 4D, you must have a specific key 
info.plist and --deep --sign the app again.

c.f. https://github.com/miyako/4d-utility-build-application

also, you need to be in application mode, because the edit menu in design mode 
does not have that menu item.

finally, the keyboard shortcut does not seem to work, even manually (I had to 
click the menu item)

I am not sure it is possible to invoke the palette this way.


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Help LEP macOS to open the Emoji viewer

2019-03-09 Thread Armin Deeg via 4D_Tech
Hi,

I like to display the charmap from macOS to allow the insert of special chars 
in Write Pro.

When I paste this in terminal it works 
   
   osascript -e 'tell app "System Events" to keystroke space using 
{control down, command down}‘

When I try this with LEP, nothing happens, what I’m doing wrong ?

   $cgiScript:="osascript -e 'tell app \"System Events\" to 
keystroke space using {control down, command down}'"
   LAUNCH EXTERNAL PROCESS($cgiScript;$vt_in;$vt_Out;$vt_err)


Thanks Armin
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

CONVERT PICTURE v17

2019-03-09 Thread David Garrard via 4D_Tech
I have some legacy pictures fields with .PICT pictures in them in my
Windows database that I am converting to v17 64 bit.  Here is my code to
convert the pictures to JPG format.

ALL RECORDS([DOCC_Document])
For ($i;1;Records in selection([DOCC_Document]))
GOTO SELECTED RECORD([DOCC_Document];$i)
GET PICTURE FORMATS([DOCC_Document]Document_Icon;$aTPictureFormats)
CONVERT PICTURE([DOCC_Document]Document_Icon;".jpg")
SAVE RECORD([DOCC_Document])
End for

The documentation suggests that this would convert the pictures in the
database to jpg format and they would lose the "ugly big cross on PICT"
replacement icon.  But I see no changes.

I must be doing something fundamentally wrong... Any ideas?

David Garrard
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**