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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Shell to Open Windows Explorer: iPhone Path for Photos

Status
Not open for further replies.

mydocpro

Technical User
Mar 13, 2016
48
US
This fails to open explorer to see iphone photos:

Declare Integer ShellExecute In shell32.Dll Integer hndWin,String cAction, String cFileName,String cParams, String cDir, Integer nShowWin
cFileName = "explorer"
cAction = "open"
cPath = "iPhone\Internal Storage\DCIM\108APPLE"
ShellExecute(0,cAction,cFileName,cPath,"",1)

Do you possibly know of a way to open iPhone photos in VFP.

Utmost thanks/blessings!
Philip Traynor
 
I think that might be a relative path issue.

Try prefixing the cPath with a double backslash?

At the moment I think you are asking it to open cPath below either the folder your app started in or
perhaps your default path (something like c:\program files\myapp\iPhone\Internal Storage\DCIM\108APPLE)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Griff:
ShellExecute(0,"Open","\\mycomputer\iphone","","",1) fails for some reason
ShellExecute(0,"Open","\\mycomputer","","",1) ... succeeds

Poor man's workaround:
Code:
PROCEDURE iphoneExplore
oWSH = CREATEOBJECT("wscript.shell")
* Do WindowToSearcherOpen With "dpw","c:\dpw"  && problems
*DECLARE INTEGER ShellExecute IN shell32.dll INTEGER hndWin,STRING cAction,STRING cFileName,STRING cParams,STRING cDir,INTEGER nShowWin
ShellExecute(0,"Open","C:\DPW","","",1)	&&ROG
*oWSH.AppActivate("DPW")   && fails oft
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Tab}')	
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Tab}')	
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Tab}')	
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Tab}')	
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Enter}')	
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys("iPhone\Internal Storage\DCIM\108APPLE")
*!*	WAIT WINDOW "" TIMEOUT 0.2
*!*	oWSH.SendKeys("iPhone\Internal Storage")
*!*	WAIT WINDOW "" TIMEOUT 0.2
*!*	oWSH.SendKeys("\DCIM\108APPLE")
WAIT WINDOW "" TIMEOUT 0.2
oWSH.SendKeys('{Enter}')

I'll keep you posted if I progress.
Utmost thanks/blessings,
Philip
 
I have an idea, can you use a subst command to map a drive letter to the iPhone folder?

Code:
cd \iPhone
subst x: .

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I'm only saying because the need for the 'keyboard' stuff looks tenuous and unreliable

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
If ShellExecute() fails, it will return an error code that tells you what went wrong. In other words:
Code:
lnCode = ShellExecute(0,"Open","\\mycomputer\iphone","","",1)
IF lnCode <= 32
  * Something went wrong
  * lnCode contains the error code
ENDIF

Perhaps you could try that and then let us know what the error code contains.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike and all:
Code:
lnCode = ShellExecute(0,"Open","\\ROG\iPhone\Internal Storage\DCIM\108APPLE","","",1) &&ROG = mycomputer
IF lnCode <= 32 && error
  MESSAGEBOX(lnCode)
ENDIF
lnCode = 3 "The specified path was not found."

Code:
lnCode = ShellExecute(0,"Open","Iphone","","",1)
IF lnCode <= 32 && error
  MESSAGEBOX(lnCode)
ENDIF
= 2 = "The specified file was not found"

Code:
lnCode = ShellExecute(0,"Open","ROG\Iphone","","",1) &&ROG = mycomputer
IF lnCode <= 32 && error
  MESSAGEBOX(lnCode)
ENDIF
= 2 = "The specified file was not found"

Etc. ... Errors are always #2 or #3 (above). Of course I checked connections and could manually type in "iphone" into explorer-address bar ... and it would open the iPhone directory.

Utmost thanks and blessings.
 
GriffMg,

Thank you for your creative thoughts. CD and Getdir() both fail to navigate to iPhone in VFP 9 (Win10).
Interestingly, Getfile() does navigate the Win10 directory hierarchy. So I'd expect a Shell command to do the same.

So if I pull up an iPhone file, Getfile() -->:
C:\USERS\PHILIP\APPDATA\LOCAL\MICROSOFT\WINDOWS\INETCACHE\IE\A8URGNKR\IMG_8926[1].JPG

Code:
ShellExecute(0,"Open","C:\USERS\PHILIP\APPDATA\LOCAL\MICROSOFT\WINDOWS\INETCACHE\IE\A8URGNKR","","",1)
IF lnCode <= 32
--> IE (irrelevant) cached files, iirc.

I will keep you posted, as I experiment.

Utmost thanks/blessings!
Philip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top