Author |
|
SteveA Groupie
Joined: November 28 2002 Location: United States
Online Status: Offline Posts: 49
|
Posted: November 15 2004 at 10:45 | IP Logged
|
|
|
Hi Dave,
Timing on this new feature is perfect! Been struggling with interfacing PH - other software - My web site by utilizing scripts and it's gotten a little ugly.
Could you give an example of using the formula? I've been tring the following without success.
ph_itcexecuteftp (1, "SEND C:/SECURITY/GOTCHA.JPG FTP:// SPECLAKE.COM/WEB/TEST.JPG", "SCAN DONE", 0 )
Tried varios numbers (1-10) for the 1st parameter but always get a formula return value of 1.
Thanks, Steve A
__________________ SteveA
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 15 2004 at 11:19 | IP Logged
|
|
|
Steve,
Im glad I sneaked those new functions in for you
The return code of 1 you are getting is because the ITC control has not yet been created.
The new ITC functions must be used as an interactive set. You won't be able to get much use out of them
using individually.
The first thing you have to do is create the ITC control. This can be accomplished like this:
ph_itccreate(1)
PowerHome allows you to have up to 10 simultaneous ITC controls. The above function declares that you wish to create and use #1.
The next thing you need to do, is set the ITC to the proper URL as well as the userid / password for FTP sites:
ph_itcseturl(1,"www.yourdesiredsite.com")
ph_itcsetuserpass(1,"userid","password")
Now you'll be ready to use your above function. You'll probably need to adjust slightly like I did below:
ph_itcexecuteftp(1,"SEND c:\security\gotcha.jpg /web/test.jpg","SCAN DONE",0)
When you are done with your FTP session, then you should destroy the ITC to free up memory like below:
ph_itcdestroy(1)
Let me know how that goes and good luck!
Dave.
|
Back to Top |
|
|
SteveA Groupie
Joined: November 28 2002 Location: United States
Online Status: Offline Posts: 49
|
Posted: November 15 2004 at 12:57 | IP Logged
|
|
|
Dave,
Works sweet and about three times faster than my current config...
Your the man... Thanks!
Steve
__________________ SteveA
|
Back to Top |
|
|
SteveA Groupie
Joined: November 28 2002 Location: United States
Online Status: Offline Posts: 49
|
Posted: November 17 2004 at 21:32 | IP Logged
|
|
|
Dave,
Not sure if this is a bug or not... Formula doesn't upload files if there's a space in the path name.
SA
__________________ SteveA
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 21 2004 at 21:21 | IP Logged
|
|
|
Steve,
This is a problem with the Internet transfer control. You should be able to work around it though by placing double quotes around the long filename. Use single quotes to enclose the entire FTP string. Like this:
'Get testfile.txt "c:\program files\powerhome\testfile.txt"'
I havent tested this yet but I base it upon the following Microsoft article: http://support.microsoft.com/kb/263839/en-us/
Let me know if this works for you.
Dave.
|
Back to Top |
|
|
seattlechris Groupie
Joined: June 29 2002 Location: United States
Online Status: Offline Posts: 49
|
Posted: December 03 2004 at 09:53 | IP Logged
|
|
|
Dave,
I can confirm that the double quotes within single quotes works, that's how I'm running right now.
Thanks for including that FTP function, it's quite handy. My challenge was similar to Steve's; I was using a third party FTP program to upload security camera snaps. It mostly worked, but it was awkward and slow. I replaced it with the PH FTP functions and it works much better now.
Question though-- is it appropriate to issue the CLOSE command prior to the ITC destroy?
A couple quirks I should bring up, although don't get me wrong I'm in fact very pleased with this FTP function:
The CLOSE command does not result in any call-back to the specified macro. Also, the SEND/PUT command, unlike the PWD command for example, does not generate any status that can be read via the ITC get data command. It would be desirable to have feedback that the FTP upload completed successfully.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 03 2004 at 15:48 | IP Logged
|
|
|
Chris,
Great comments on the FTP control
Yes, it would be appropriate to issue a CLOSE command before doing a ph_itcdestroy. I havent found it necessary, but it is appropriate.
You are correct. The CLOSE and QUIT commands will not fire the callback macro. This is because the callback macro is only called on icError and icResponseCompleted state changes. I have made changes to the control so that icDisconnected is returned as well. You'll see these changes in the next version.
The SEND/PUT and other commands do return a status, it just wasn't documented (my bad ). When the callback macro is executed, the [TEMP1] variable will have the state. In the current version, this will be either 11 (icError - most likely a timeout) or 12 (icResponseCompleted - success). The next version will also include 10 (icDisconnected - what QUIT and CLOSE returns). Additionally, if the state is 11 (icError), the [TEMP2] variable will contain the response code and the [TEMP3] variable will contain the response info.
Hope this helps,
Dave.
|
Back to Top |
|
|
seattlechris Groupie
Joined: June 29 2002 Location: United States
Online Status: Offline Posts: 49
|
Posted: December 05 2004 at 13:08 | IP Logged
|
|
|
Excellent, as usual you answered all my questions.
In lieu of the callback from the CLOSE command, I just do the ph_itcdestroy thing right after. Apparently no kind of delay is required, as it seems to work. But if this is risky because PH internals, let me know.
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 05 2004 at 22:10 | IP Logged
|
|
|
Chris,
It should be no problem to immediately destroy.
Check out the newest beta version 1.03.4.3. It will have the response code 10 for the QUIT and CLOSE commands.
Dave.
|
Back to Top |
|
|