Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Using rapi from desktop to copy file from device to desktop

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-07-2008, 07:18 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default Using rapi from desktop to copy file from device to desktop

It should be so simple, but it's not working.
I have made a simple program (almost the example):

I want to copy the file LGXVRDmu.CSV from my device (in \My Documents) to my desktop computer. I am using activesync and it's connected OK.
Two problems:
1. my programs says 'cannot connect to device.'
2. if i delete this check (rapi.isconneted=true) I get a new error that he can not write.

Sub Button2_Click
rapi.New1
rapi.Connect
t = Now '3 seconds timeout.
Do Until rapi.IsConnected = true
DoEvents
If (Now - t)/cTicksPerSecond > 3 Then
Msgbox("Cannot connect to device.")
AppClose
End If
Loop
If rapi.DeviceFileExists("\My Documents\LGXVRDmu.CSV") = true Then
rapi.CopyFileFromDevice1("\My Documents\LGXVRDmu.CSV",AppPath)
End If
End Sub
Reply With Quote
  #2 (permalink)  
Old 01-07-2008, 07:26 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Did you connect the device before running the program? (you should)
Try to increase the time limit.

What is your ActiveSync version?
Reply With Quote
  #3 (permalink)  
Old 01-08-2008, 05:33 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default

I have made it wait 10 secs; same problem.
The PPC is connected before starting the program.
I am using activesync 4.5
Strange...

Last edited by sunnyboyj : 01-08-2008 at 05:36 PM.
Reply With Quote
  #4 (permalink)  
Old 01-08-2008, 05:41 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You could try to uninstall and reinstall Activesync.
Another option is to use a different approach and send the file using Network library (based on Activesync connection).
Reply With Quote
  #5 (permalink)  
Old 01-08-2008, 07:24 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default

I tried it but does not work. Then I cut my program in pieces:
I get the message 'connected'
I get the message 'file found' (so it can get the file when i start the program from desktop)
Then I get the error message, I think my syntax is just not correct:
Error is: Not a valid boolean (translated from Dutch error message).
I think I make an error copying from device (\My Documents\LGXVRDMU.CSV)
to my desktop: C:\downloads\

Form1.Show
rapi.New1
rapi.Connect
Sub Button2_Click
Msgbox ("Connected")

If rapi.DeviceFileExists("\My Documents\LGXVRDMU.CSV") = true Then
Msgbox("File Found")
rapi.CopyFileFromDevice2("\My Documents\LGXVRDMU.CSV","C:\downloads")
End If

End Sub
Reply With Quote
  #6 (permalink)  
Old 01-09-2008, 06:06 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

This code copies a file from the device to the desktop (to the current path):
Code:
Sub Globals
End Sub

Sub App_Start
    Form1.Show
    rapi.New1
    rapi.Connect
End Sub

Sub Rapi_Connected
    
Msgbox("connected")
    
If rapi.DeviceFileExists("\My Documents\a.exe") = true Then
        
Msgbox("file exists")
        rapi.CopyFileFromDevice1(
"\My Documents\a.exe",AppPath)
    
End If
End Sub
Reply With Quote
  #7 (permalink)  
Old 02-07-2008, 03:53 PM
Newbie
 
Join Date: Feb 2008
Posts: 6
Default and use the same in device

and I want make the same but from on aplication on the device.

I execute the programe on the device and Iwant copy 1 file from the device to de c:\ directory???
Reply With Quote
  #8 (permalink)  
Old 02-07-2008, 06:07 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

It is not possible with the RAPI library.
You can use the Network library to send the file.
Reply With Quote
  #9 (permalink)  
Old 02-08-2008, 11:37 AM
Newbie
 
Join Date: Feb 2008
Posts: 6
Default ok

Quote:
Originally Posted by Erel View Post
It is not possible with the RAPI library.
You can use the Network library to send the file.
Ok.
for exemple I have a secret file and on clik botton1 (using network) lib the file is copied from de device to the pc.
exemp:

FileCopy("pass.ert","c:\pass.ert") - but using the network

O I make this??????

sory mi inglish
Reply With Quote
  #10 (permalink)  
Old 02-08-2008, 12:40 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

See the FileTransfer example: http://www.basic4ppc.com/Downloads.html
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Device or Desktop DaveW Questions (Windows Mobile) 2 11-07-2008 01:04 PM
FileSize(file) brings up error on device - but not on Desktop TWELVE Questions (Windows Mobile) 7 05-10-2008 03:54 PM
Using RAPI library to transfer database from device to desktop mozaharul Questions (Windows Mobile) 4 04-01-2008 09:55 AM
Different behaviour DeskTop and Device HARRY Questions (Windows Mobile) 2 02-22-2008 01:36 PM
Problems using rapi to send files to desktop sunnyboyj Questions (Windows Mobile) 4 01-06-2008 06:40 AM


All times are GMT. The time now is 05:17 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0