grantwood Posted February 23, 2006 Posted February 23, 2006 Hello, I am having trouble opening a file with a given application. For example, if I wanted to open a database with FileMaker, I would use this command: >"C:Program FilesFileMakerFileMaker Pro 8FileMaker Pro.exe" "C:pathtodesktopexample.fp7" This works via the actual command line but not with the shell plugin. I even used the Quote function to deal with spaces in the paths. I get the following error: 'C:Program' is not recognized as an internal or external command, ..." Any ideas? Regards, Sean
SlimJim Posted February 23, 2006 Posted February 23, 2006 Try replacing "Program Files" by the old-fashioned DOS name Progra~1. You will probably have to do the same with other elements of the path which contain spaces.
grantwood Posted February 23, 2006 Author Posted February 23, 2006 Hi SlimJim, Here's the weird thing. The following command works just fine with the plugin: dir /b "C:Program FilesFileMakerFileMaker Pro 8" Maybe it's a bug with the plugin. Is there an easy way to convert a "regular" path into an old-fashioned DOS path?
SlimJim Posted February 23, 2006 Posted February 23, 2006 The simplest way, I think, is to open a command prompt travel to the directory you are interested in and then issue the command dir /X. That gives you two columns of names (on the right) the first column is the DOS name and the second column is the long filename. If the long file name satisfies 8.3 already then there is no entry in the first column,
Wim Decorte Posted February 23, 2006 Posted February 23, 2006 Why not simply use the Send Event script step (you don't need the shell plugin for this) cmd /c "C:Program FilesFileMakerFileMaker Pro 8FileMaker Pro.exe" "C:pathtodesktopexample.fp7"
grantwood Posted February 23, 2006 Author Posted February 23, 2006 Hi Wim, If I have the two paths stored in local variables ($appPath and $docPath), would I need to specify a calculation, something like: "cmd /c " & Quote ($appPath) & " " & Quote ($docPath)?
grantwood Posted February 23, 2006 Author Posted February 23, 2006 Hi Wim, The actual example is opening a folder full of images with a program called DicomWorks. Here is the calculated command with hard-coded paths: "cmd /c " & Quote ( "C:Program FilesDicomWorksDicomWorks.exe" ) & " " & Quote ( "C:Documents and SettingsusernameDesktopimages" ) FileMaker is putting "" at the end of the folder path, so I tried substituting all backward slashes with forward slashes, but still no luck. What am I doing wrong?
grantwood Posted February 23, 2006 Author Posted February 23, 2006 A little bit more info: I don't have to specify a trailing slash for the folder path, so the following works in the Win shell: "C:Program FilesDicomWorksDicomWorks.exe" "C:Documents and SettingsusernameDesktopimages" My problem is that I can't run this command from FileMaker, either via the shell plugin or the Send Event script step.
grantwood Posted February 23, 2006 Author Posted February 23, 2006 ok, I think I have a working solution. I just eliminated the "cmd /c" part and the images opened just fine, although I had to manually bring the DicomWork app to the front.
Wim Decorte Posted February 24, 2006 Posted February 24, 2006 From the solutions forum, download the VBscript demo I have there. It uses the command line for a couple of things. I have a feeling we're not quite on the same page here with the Send Event. Check how I use the Send Event and "cmd /c" there.
grantwood Posted February 24, 2006 Author Posted February 24, 2006 Hi Wim, I looked at your vbscript demo, and I think we're on the same page. Just to recap, here's what I'm trying to do: open a folder full of images in a program called DicomWorks. Here's what I've tried so far. 1) Just to get to syntax working (I'm a Mac guy), I confirmed the following command works from the Win shell: "C:Program FilesDicomWorksDicomWorks.exe" "C:pathtoDesktopimages" 2) I then tried running the above command with the shell plugin. No luck. 3) Based on your sugesstion, I then tried running the above command using the Send Event script step, specifying a calculation as follows: "cmd /c " & Quote ( "C:Program FilesDicomWorksDicomWorks.exe" ) & " " & Quote ( "C:pathtoDesktopimages" ) To my surprise, this didn't work. 4) Just on a whim, I tried running the above command without the "cmd /c " part, specifying a calculation as follows: Quote ( "C:Program FilesDicomWorksDicomWorks.exe" ) & " " & Quote ( "C:pathtoDesktopimages" ) Also to my surprise, this worked, although the DicomWorks app doesn't come to the front. In your vbscript demo you have a "cscript" command, which I'm assuming I don't need. So, I still need to get DicomWorks to come to the front (even though the "Bring target application to foreground" option is checked). FWIW, let's say I just wanted to open a Notepad document. The following calculation in the Send Event dialog works: Quote ( "C:WINDOWSsystem32notepad.exe" ) & " " & Quote ( "C:pathtoDesktopexample.txt" ) Notepad does in fact come to the front. Adding a "cmd /c " before the command does not work.
grantwood Posted February 25, 2006 Author Posted February 25, 2006 Wim, I exchanged some emails with the developer of DicomWorks. He wrote the app in Visual Basic. Can I use vbscript to bring DicomWorks to the front? I don't know vbscript, so I checked out your vbscript repository db, but I didn't see anything pertaining to manipulating windows. Also, can I use vbscript to handle everything in this case (opening DicomWorks if not already open, opening the folder of images, and then bringing the app to the front)? Regards, Sean
Wim Decorte Posted March 4, 2006 Posted March 4, 2006 Hi Sean, Sure you can use VBscript to bring any app to the foreground. VBscript has an "appActivate" method; if you give it the caption of any app, it will find it and bring it forward. Check out www.kevinfrank.com, in the download section he has a little app utility that does a lot of "window" stuff on Windows. See if it works for you, if not post back and we'll take it from there.
grantwood Posted March 6, 2006 Author Posted March 6, 2006 Hi Wim, I think there's something "weird" about this DicomWorks program. I asked a question on http://www.experts-exchange.com and someone suggested some code to bring the app to the foreground, but the app wouldn't respond. Here's what we tried: Set WshShell = WScript.CreateObject("WScript.Shell") intReturn = WshShell.Run("""C:Program FilesDicomWorksDicomWorks.exe"" ""C:pathtoDesktopimages""", 9, FALSE) We ended up quitting the app via vbscript and then opening it again. Not the greatest workaround, but better than nothing. Sean
Wim Decorte Posted March 6, 2006 Posted March 6, 2006 (edited) What you to bring it forward after opening it is another line like this: WshShell.AppActivate "< caption of the dicom app>" The caption is the title in the blue bar. You probably need a short pause (WScript.Sleep 500) between the run and the appActivate to give Windows some time to actually complete the run command. Do check with the creator of DicomWorks if they have built ActiveX objects into the app. Then all this would be so much easier. Edited March 6, 2006 by Guest
Recommended Posts
This topic is 7176 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now