Re: Object notation replacement for use of Self in a script — v18

2020-04-30 Thread Peter Hay via 4D_Tech
Hi Chris,

What we really need is a way to access a Form Object's "Variable or
Expression".  There's a Command named "Object Get Data Source" which was
added in v14, but it only returns a Pointer if  "Variable or Expression" is
a Variable.  If it's an Expression it returns Nil.

If we could get the Expression, then we could use Evaluate Formula to
Get/Set the Value.

There's currently no 4D Command to do this directly, but you can do it
using "Form Convert to dynamic".  It's an "expensive" command, but it does
the job until 4D give us a better way.


  //Method: Object Get Expression
  //Returns the Expression / Data Source of the Form Object named $1

C_TEXT($0)  //Object Expression / Data Source
C_TEXT($1)  //Optional, Object Name.  Default = the Current Object

C_LONGINT($l_Page)
C_OBJECT($o_Form)
C_TEXT($t_ObjectName)

Case of
: (Count parameters<1)
$t_ObjectName:=OBJECT Get name(Object current)
: ($1="")
$t_ObjectName:=OBJECT Get name(Object current)
Else
$t_ObjectName:=$1
End case

If ($t_ObjectName#"")
If (Current form table=Null)
$o_Form:=FORM Convert to dynamic(Current form name)
Else
$o_Form:=FORM Convert to dynamic(Current form table->;Current form name)
End if

If ($o_Form.pages#Null)
$0:=String($o_Form.pages[FORM Get current
page].objects[$t_ObjectName].dataSource)  //The Object is most likely to be
on the Current Page, so start looking there

If ($0="")  //Not on the Current Page, so look at all Pages
For ($l_Page;0;$o_Form.pages.length-1)
If ($l_Page#FORM Get current page)  //We've already checked the Current
Page, so no need to check it again
$0:=String($o_Form.pages[$l_Page].objects[$t_ObjectName].dataSource)

If ($0#"")
$l_Page:=999
End if
End if
End for
End if
End if
End if



Ideally I'd like to have Object Get Value and Object Set Value commands.

I present to you;

---
  //Method: Object Set Vaule

C_TEXT($1)  //Object Name
C_VARIANT($2)  //Value

C_TEXT($t_DataSource;$t_ObjectName)

C_VARIANT(__ObjectValue)  //Required for EXECUTE FORMULA

If ($1="")
$t_ObjectName:=OBJECT Get name(Object current)
Else
$t_ObjectName:=$1
End if

If ($t_ObjectName#"")
$t_DataSource:=Object Get Expression ($t_ObjectName)

If ($t_DataSource#"")
__ObjectValue:=$2  //Params and Locals can't be used in EXECUTE FORMULA
EXECUTE FORMULA($t_DataSource+":=__ObjectValue")
End if
End if



---
  //Method: Object Get Vaule

C_VARIANT($0)  //Object Value
C_TEXT($1)  //Object Name.  Default = the Current Object

C_TEXT($t_DataSource;$t_ObjectName)

C_VARIANT(__ObjectValue)  //Required for EXECUTE FORMULA

Case of
: (Count parameters<1)
$t_ObjectName:=OBJECT Get name(Object current)
: ($1="")
$t_ObjectName:=OBJECT Get name(Object current)
Else
$t_ObjectName:=$1
End case

If ($t_ObjectName#"")
$t_DataSource:=Object Get Expression ($t_ObjectName)

If ($t_DataSource#"")
EXECUTE FORMULA("__ObjectValue:="+$t_DataSource)
$0:=__ObjectValue  //Params and Locals can't be used in EXECUTE FORMULA
End if
End if


It's very round about code, but not particularly complicated, which makes
me wonder why 4D don't just give us some commands to do it.

Anyway, I hope these work for you.  They work for me.

-- 
Pete Hay
Managing Director
Foreground Software Limited
New Zealand
**
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
**

CURL SFTP issues with SSH

2019-11-21 Thread Peter Hay via 4D_Tech
Hi,

I'm using Miyako's CURL-FTP plugin to try and connect to an SFTP site using
SSH keys, but I keep getting an error 67.  I've tried the same settings
using CURL from the command line, and get the same error.  I've also tried
the same thing using FileZilla and it works perfectly, so I know the SSH
Keys files are in good shape.

When I run CURL form the command line in verbose mode, here's what I get;

curl -u THEUSER: --key "C:\SSH_Private.ppk" --pass "ThePassword" --pubkey
"C:\SSH_Public.key" sftp://ftp.thesite.com/OUT/ -v -k
*   Trying 123.456.789.0 :22...
* TCP_NODELAY set
* Connected to ftp.thesite.com (123.456.789.0) port 22 (#0)
* SSH MD5 fingerprint: 4dc2acee06bdaa70fc67412187362428
* SSH authentication methods available:
publickey,password,keyboard-interactive
* Using SSH public key file 'C:\SSH_Public.key'
* Using SSH private key file 'C:\SSH_Private.ppk'
* SSH public key authentication failed: Invalid key data, not base64 encoded
* Failure connecting to agent
* Authentication failure
* Closing connection 0
curl: (67) Authentication failure


I've obfuscated some of the details, but you get the idea.

The main problem seems to be that CURL thinks the Public Key should be
Base64 encoded.  I'm pretty sure that it is.  It looks like this;

 BEGIN SSH2 PUBLIC KEY 
B3NzaC1yc2EAAA  ...   4QvuPGkd+ocvyWQ==
 END SSH2 PUBLIC KEY 


As I said, FileZilla works fine with all of this.

Does anyone have any idea what the issue may be?

-- 
Pete Hay
Managing Director
Foreground Software Limited
New Zealand
**
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
**

Formulas with XLS Plugin

2019-08-28 Thread Peter Hay via 4D_Tech
Hi,

Does anyone know if it's possible to create formulas with Miyako's XLS
Plugin?  I've managed to functions working but I'm struggling with
formulas.  eg. =A1+B1

Thanks.

Regards,
Pete Hay
Foreground Software Limited
New Zealand
**
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
**

Xero and Private apps

2019-07-29 Thread Peter Hay via 4D_Tech
Hi,

Has anyone had success in integrating a 4D app with a Private
Xero account?  I've had success with connecting to a Public Xero account
using OAuth, but I can't work out how to sign a Request for a Private Xero
app.

Thanks.
-- 
Pete Hay
Managing Director
Foreground Software Limited
New Zealand
**
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: From where is my form method called?

2019-04-16 Thread Peter Hay via 4D_Tech
Hi Sandor,

I've got a feature request that you may want to vote on, for exactly this
scenario .

https://forums.4d.com/Post/EN/29304309/1/29304310#29304310

-- 
Pete Hay
Managing Director
Foreground Software Limited
New Zealand
**
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: How to get the Window ref of the 4D 64 bit app window

2019-02-01 Thread Peter Hay via 4D_Tech
Keith, that doesn't seem to work on Windows unfortunately.

Miyako, Thanks for the link to your 2 plugins.  I should have known to
check your GitHub account.  ;-)

I tried both of your plugins.  Set Window Title for the MDI window works
perfectly, but I couldn't get the icon to be set correctly.  The Icon
changes, but it changes to the Windows default icon for a picture file.
The one that looks like tiny blue mountains.

I tried it on 64 bit versions of 4D v17R3 and v16, with both of your
plugins and got the same results.  I also got the same result on the big
test button in your test database, Window Control.4DB, which changes the
icon on a "normal" 4D window, not the MDI window.

I'm running 64 Bit Windows 10 Pro 1809.

Thanks for these plugins.  I really appreciate all of your time, effort and
knowledge that you share so freely with the 4D community.

-- 
Pete Hay
**
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
**

How to get the Window ref of the 4D 64 bit app window

2019-01-31 Thread Peter Hay via 4D_Tech
Hi,

I'm trying to get the Window reference of 4D's application window so that I
can put a custom icon on it, and change the window title.

This is for 64 bit 4D v17R3 on MS Windows.

I've been doing this for years with the excellent Win32API
using gui_GetWindowEx ("").  This works fine with 32 Bit 4D apps, but fails
on 64 bit apps.  I've checked with Orchard Software, and they confirm the
issue, but they're still using 32 bit 4D Remote, so it's not a priority for
them.  I have no problem with this stance.  It's their plugin, and it's
free, and I'm very grateful for them giving it away.

So, does anyone know how to get the 4D window ref of the main 4D
application MDI window for 64 bit 4D apps?

Thanks.
 --
Pete Hay
Managing Director
Foreground Software Limited
New Zealand
**
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: Win32API 8.1.2 gui_GetWindowEx("") in v16r5

2018-01-29 Thread Peter Hay via 4D_Tech
Hi Jason,

I logged an issue about this with Orchard about a year ago;
https://github.com/OrchardSoftware/4D-Win32API/issues/24

From what they say, it's a 4D Plugin SDK issue and there's a work around,
but Orchard doesn't seem to have implemented it yet.

I haven't hassled them about it, because it's a free plugin, and I'm very
grateful for it.  I'm sure they'll get around to fixing it when they can.

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