Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pcANYWHERE OLE code for VB 19

Status
Not open for further replies.

fwadmin

IS-IT--Management
Jun 23, 2005
6
0
0
US
I have a bunch of pcANYWHERE script files written to do various automatic transfers. It seems that Symantec's newer versions of pcANYWHERE no longer support the script files and now use OLE for integration into other applications. The documentation for this completely stinks in that they give no VB examples of invoking transfers.

Anyone out there have any VB code with pcAYNWHERE they can share?

Thanks.
 

I need to transfer a file from another machine to my local machine everyday.
I have the following code. It is establishing a connection but fails to transfer the file. It has to transfer Vendors.mdb from C:\Pda folder in another machine to C:\Pda folder in my machine. The transfer doesn't go through. Can any of you tell me where I am going wrong?

This is my VB code -

Private Sub Form_Load()

Dim Remote, strSource, strDestination, strCommand
Dim WentOK As Boolean
Dim bResult As Boolean
Set Remote = CreateObject("AWREM32.APPLICATION")
WentOK = Remote.awConnect("C:\Documents and Settings\All Users\Application Data\Symantec\pcAnywhere\Vendor.CHF")

If WentOK = False Then
MsgBox "Connection failed"
Else
MsgBox "Connection OK"
End If

'Transfer from Host
strSource = "C:\Pda\Vendors.mdb"
strDestination = "C:\Pda\Vendors.mdb"

WentOK = Remote.FileXferFromHost(strSource, strDestination)

If WentOK = True Then
MsgBox "Transfer from host successful"
ElseIf WentOK = False Then
MsgBox "Transfer from host not successful"
End If

' Disconnect from the host
WentOK = Remote.awDisconnect()

Unload Form1

End Sub
 
Hi, patcjag

You failed to transfer a file or you failed to establish a connection with the host machine? If you can establish the connection but failed in transfering a file. You can get the error by Remote.GetError method to find out what the error you got there. Hope this help~~~

:p
 

Hi cwlee1
Thanks for the response.
I now have a problem exactly the same as your problem (which you posted on August 5). Did you find a solution for that?
If I put in a Messagebox after the connect, that msg shows up during runtime. I click on it and the transfer code which follows runs as it should. But if I comment the Msgbox, then the system for some reason does not proceed with the transfer code. Do you have any solution???


 
Yup, this is because the slow response of modem.
I have put this code for checking if the connection is connected:

Private Sub pause(time As Integer)
timer1.Enabled = True
checkTime = 0

While checkTime <= time
'checktime is incremented by 1 every second
DoEvents
WEnd

timer1.Enabled = False
End Sub

Private Function isConnected() As Boolean
i As Integer

'Initialization
isConnected = False

'I checked if the connection is connected for 7 seconds
'You can tune it as you like
For i=0 to 6 Do
If awremObj.ConnectionStatus() = True Then
isConnected = True
Exit For
End If
pause(1)
next

End Function

Use isConnected() to check if the connection is ok for modem connection is better as the response of the 56K modem is too slow. If you just use awremObj.ConnectionStatus() to check it, it may immediately return false as the signal is not yet arrived...

Hope this could help~~~
 
Is there any method to know if the file transfer successfully executed?
because I want to perform these processes:
1. send first file to host
2. send second file to host
3. execute .exe file on host
4. retrieve file from host
and they are sequencially executed.
I use VB6,pcAnyhwhere 10.5
if a process is failled or error the rest of the process will not be executed.
so far i found that this script:

bResult=oApp.FileXferToHost(strDestination,strSource)

did not return the actual result of transfer, it returned true even if the transfer is not successfull !


 
Hi everyone !
Does anyone know how to perform automatic file transfer in scripting of pcanywhere 10.5 (sample code)?
 
Yes, Durda

This is Brian with Harrison Restaurants,Inc. :)
Everyone here is excellent with their information and
programming skills. I have been using automated polling now since April 2003 with no problems to report yet. Thanks everyone for all the input!
 
Hi everyone,

Thanks for the useful code examples here, I'm hoping someone can point me in the right direction as I'm stuck at the beginning...

I can't get the:
set Object = CreateObject(&quot;Awrem32.Application&quot;)
line to work. I've tried setting a reference to awrem32.exe but VB6 reports &quot;Can't add a reference to the specified file&quot;.

I can create WINAWSVR.REMOTEDATAMANAGER and related objects with no problem. To be able to create these objects I had to run WinAwSvr.exe after installing PcAnywhere, to register these objects in the system registry. I can easily find 'WinAwSvr.xxxx&quot; objects in the HKEY_CLASSES_ROOT branch of the registry, but there is no 'Awrem32.application' object.

I am sure my code will work if this object exists in the registry - but how can I make this happen? I tried running awrem32.exe, following the same logic as above, to get the other objects registered, but this had no effect.

Any help would be very much appreciated as I am trying to automate the dial-in process for over 1300 resturants.

Regards,
Dave
 
FYI,

I've solved my problem with creating the Awrem32 object.

I had to download awrem32.tlb that I found on Symantec's site. I could then set a reference to this type library from VB. It would still not let me use the CreateObject line but now even better, I can use:

Dim Object As New AWREM32.Document

The interface did not expose an application object, it was called Document...?

I can now enter the variable name and the IDE returns a list of methods when the full stop is pressed!

Now for testing the file transfer and launch remote file features....

Dave
 
hi all


- i want to sent a file from remote to host but but i do NOT want file to overwrite.

- and how can i know if file exists at host?


thanks
 
VERSION 11!!!

Has anybody had experience with Transferring a file from version 11 to another version 11?

I can transfer fine between version 11 and version 10.5 or lower compatible versions. It seams weird but it just doesn't work.

Once a connection is made and I make a call to HostObject.FileXferFromHost it just seams to sit there and the HOST end has a file transfer window with Waiting and nothing happens at the REMOTE end!

Thanks...
 
mehmetcan,

set your file transfer options to &quot;never overwrite duplicate files&quot; or whichever option you prefer
 
I've been following this thread for a while and it's helped me immensely with my current project.

I'm trying to run 2 different programs on the Remote Host. These programs will each create a file. I then want to download the 2 files to my local machine.

I created a batch file which will call the two programs and I start by transferring it to the Remote. This works fine. I then try to execute the batch file on the remote host, but it NEVER works. I have even logged in manually to the Remote and run the batch file. It works as expected. But for some reason, the execute command in my code is not working. Any ideas? Here's the snippet of code:

batchFile = batDir & &quot;my.bat&quot;

transferResult = pcApp.FileXferToHost(&quot;C:\temp\my.bat&quot;, batchFile)
Call Wait(10)

execCommand = &quot;C:\temp\my.bat&quot;
execResult = pcApp.ExecuteHostFile(execCommand)

execResult even returns true, but it never successfully runs. Any help would be greatly appreciated. Thanks!

Doug
 
VERSION 11 Problem...

Still no luck, SIBASIS already have tried adding a pause in and changing the transfer options... Has anybody actually tried between 2 version 11's and transferred a file using the OLE stuff??? It works ok when we do it manually, but hangs when we do it using OLE...

Thanks For Help,

Marcus
 
Marcus, I do the same thing in 10.5 with no issues, I still haven't tested version 11 yet, I have no problems executing batch files at all, the only thing I found to be a problem is when you pass a param to the batch file. If I find anything on this I will post it here.
 
Thanks sibasis,

It's a weird problem. I thought it might be something with my permissions on the remote machine, but I'm able to connect manually and run the batch file. So, it just doesn't make sense. I'll continue to play with it, but thanks for the help.

Doug
 
Marius try this!

transfer the batch file manually! and then run your script(comment out the batch file transfer in your script) see if the batch file gets executed on the host this time, if it does then its definitely a initializing issue :eek:) I dont know what else to try .. you are referencing all the required tlb's right ?
 
Thanks sibasis!

I've actually gotten a bit farther on the problem. It seems to be an issue with the environment on the remote host. I'm working on a few work arounds to make it work and I think I'll eventually get it. It's kinda just trial and error at this point, but thanks for all the help!!
 
Good day all,
I read though all the post here looking for someone that has made it farther using .Net and PCA OLE integration than I have. I think I can help those that want to use it. The fist thing to do is create a Runtime Callable Wrapper for .Net If you have the SDK (.Net) installed the Executable you want to run is the loacated in \sdk\v1.1\Bin\TlbImp.exe. This exe create a callable wrapper for you to import the type lib into a .Net project. For C# developers be sure to look at the C++ pcaole.pdf section. Pay close attention to when the function expects a pointer as a parameter (&quot;ref&quot; keyword in .Net). I hope this helps those who are tying to get started using .Net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top