Unable to open a document from command line

General comments and questions. Technical support.
Csiga
Posts: 18
Joined: Sun Feb 27, 2011 8:33 am

Unable to open a document from command line

Post by Csiga »

When I'm trying to open a document from command line, I receive an error message in Atlantis shown below.
Image
Image
Any solutions for this?
Attachments
command.jpg
command.jpg (20 KiB) Viewed 10544 times
result.jpg
result.jpg (10.42 KiB) Viewed 10544 times
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

According to your screen capture, the current path is "C:\Temp". Is the "test.docx" file available under the "C:\Temp" folder?
Csiga
Posts: 18
Joined: Sun Feb 27, 2011 8:33 am

Post by Csiga »

admin wrote:According to your screen capture, the current path is "C:\Temp". Is the "test.docx" file available under the "C:\Temp" folder?
Yes, of course. But instead of the current working directory, Atlantis tries to open the given file from the directory of the executable.
Robert
Posts: 1900
Joined: Fri Aug 15, 2003 8:27 pm

Post by Robert »

If “test.docx” is located in “C:\Temp”, the proper command-line to open it in Atlantis would be:

Code: Select all

"D&#58;\Users\<USER’S NAME>\PortableApps\Atlantis\awp.exe" "C&#58;\Temp\test.docx"
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Csiga wrote:But instead of the current working directory, Atlantis tries to open the given file from the directory of the executable.
I have just conducted a couple of tests. I am not sure that you can control the current directory of Atlantis by changing the console's current directory. Atlantis is not a console application. It seems that Windows automatically sets the executable's path as a current directory. So using full paths of document files within the command-line is preferable indeed.
Csiga
Posts: 18
Joined: Sun Feb 27, 2011 8:33 am

Post by Csiga »

Robert wrote:If “test.docx” is located in “C:\Temp”, the proper command-line to open it in Atlantis would be:

Code: Select all

"D&#58;\Users\<USER’S NAME>\PortableApps\Atlantis\awp.exe" "C&#58;\Temp\test.docx"
Yes, I have already figured this out. But if I want to open test.docx in wordpad, I just type

c:\temp>wordpad test.docx

and not

c:\temp>wordpad c:\temp\test.docx

Applications should check the CWD first, not the application's install directory imho.
Last edited by Csiga on Fri Apr 12, 2019 10:51 am, edited 1 time in total.
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Sorry, what is CWD?
Csiga
Posts: 18
Joined: Sun Feb 27, 2011 8:33 am

Post by Csiga »

admin wrote:Sorry, what is CWD?
Sorry, CWD = Current Working Directory :)
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Not used the DOS commands for ages. Thanks. :)
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Will have more details later.
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Version 3.2.13.4 will have this fixed. Thanks.
rstroud
Posts: 232
Joined: Sun Mar 04, 2012 3:07 pm
Location: Tennessee
Contact:

Command line

Post by rstroud »

First, let me admit up front that I have a hard time following questions that people ask here. It is probably just my peculiar brain. So my apologies if I have missed the point entirely. Maybe what I am going to say is irrelevant to the issue under discussion here.

I am using the most recent version of Atlantis (3.2.13.4). Here is what I have found.

If I have a file 'infer.docx' in a subdirectory somewhere, like this:

C:\Users\rolan\Dropbox\Misc\infer.docx

If I want to use the command line (though why I do not know!), I can go to:

C:\Users\rolan\Dropbox\Misc>

and type 'awp infer.docx' at the prompt like this:

C:\Users\rolan\Dropbox\Misc> awp infer.docx

and hit ENTER ... I get an error.

However, if I put Atlantis on my PATH statement, things work fine. Just add:

C:\Program Files (x86)\Atlantis

at the end of your PATH statement.

Then you can open a file in Atlantis from any directory.

Again, maybe I misunderstood the issue. :?

EDITED TO ADD:

You can get a free Path manager here:

https://sourceforge.net/projects/pathtool/

It is easy to use. Just be sure to click the "Run as Administrator" button after you open the program, or it will not let you change anything, add or delete anything.
User avatar
admin
Site Admin
Posts: 2825
Joined: Wed Jun 05, 2002 10:48 pm
Contact:

Post by admin »

Do you get an error from Atlantis? Or from Windows?
Robert
Posts: 1900
Joined: Fri Aug 15, 2003 8:27 pm

Post by Robert »

The command prompt utility does not know where “awp” or “awp.exe” might be located. The full path to “awp.exe” must be entered in the command-line:
C:\Program Files (x86)\Atlantis\awp.exe (long path)
C:\PROGRA~2\Atlantis\awp.exe (short path)
Let’s suppose that we have a document named “1b.docx” in “E:\TEMPZ”.
If we first type “CD /D E:\TEMPZ” to change the current directory to “E:\TEMPZ”, then press ENTER, we can launch the following command-line to open “1b.docx” in Wordpad:
E:\TEMPZ>"%ProgramFiles%\Windows NT\Accessories\wordpad.exe" 1b.docx

On the other hand, if we use the following command-line to open “1b.docx” in Atlantis:
E:\TEMPZ>"C:\Program Files (x86)\Atlantis\awp.exe" 1b.docx
We get a message from Atlantis saying that it could not open the following file:
C:\Users\<user’s name>\Documents\Atlantis\Documents\1b.docx
It seems that Atlantis is automatically looking for the target file in its own dedicated “Documents” folder. The current directory is simply ignored. To get Atlantis to open that file, we need to specify the location of the target file:
E:\TEMPZ>"C:\Program Files (x86)\Atlantis\awp.exe" E:\TEMPZ\1b.docx
rstroud
Posts: 232
Joined: Sun Mar 04, 2012 3:07 pm
Location: Tennessee
Contact:

Answer to admin

Post by rstroud »

If I want to use the command line, I can go to:
C:\Users\rolan\Dropbox\Misc>

and type 'awp infer.docx' at the prompt like this:

C:\Users\rolan\Dropbox\Misc> awp infer.docx

and hit ENTER ... I get an error.
The error that I get is from Windows.

However, if I put Atlantis on my PATH statement, things work fine. Just add:

C:\Program Files (x86)\Atlantis

at the end of your PATH statement.

Then you can open a file in Atlantis from any directory. You do not have to provide a path to the target file.
Robert
Posts: 1900
Joined: Fri Aug 15, 2003 8:27 pm

Post by Robert »

I have added the Atlantis home folder to my current PATH environment variable. It now reads as follows:
PATH=C:\PROGRA~2\Atlantis;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Administrateur\AppData\Local\Microsoft\WindowsApps
If I change the current directory to E:\TEMPZ, I can open Atlantis through the following command-line:
E:\TEMPZ>awp
However, if I add a target file like this:
E:\TEMPZ>awp 1b.docx
Atlantis is launched but it pops a message up saying that it could not open the following file:
C:\Users\<user’s name>\Documents\Atlantis\Documents\1b.docx
On my system at least, placing the Atlantis folder in the PATH is not enough to open a target file located outside the current search PATH variable.
Atlantis has to be given a clue as to which is the current (DOS) directory. This is done through the “%CD% environment variable. So the command-line to open “1b.docx” from the current directory is:
E:\TEMPZ>awp %CD%/1b.docx
The above command-line assumes that E:\TEMPZ is the current directory, and that the path to the Atlantis executable is included in the global PATH environment variable.
HTH.
Robert
Csiga
Posts: 18
Joined: Sun Feb 27, 2011 8:33 am

Re: Command line

Post by Csiga »

rstroud wrote:Maybe what I am going to say is irrelevant to the issue under discussion here.
Kind of. You are talking about the availability of the awp executable. Yes, it has to be in the PATH to access it from everywhere in the file system.

The problem I created this thread is about the handling of the file name parameters given to the awp executable. By tradition the file name parameters without full path should be considered as being in the actual (working) directory. Awp.exe handled it differently and started searching the parameter file name in it's own directory.
rstroud
Posts: 232
Joined: Sun Mar 04, 2012 3:07 pm
Location: Tennessee
Contact:

A final comment

Post by rstroud »

Whatever, dude.

I have been doing this for over 33 years, back to the DOS 2.11 days, and I understand how the PATH environmental variable works.
rstroud
Posts: 232
Joined: Sun Mar 04, 2012 3:07 pm
Location: Tennessee
Contact:

Another final comment

Post by rstroud »

I am debating whether even to post this, since I may be missing the point of what some of you are talking about.

But I will make a point before I leave this conversation. The following works just fine:

SITUATION
Atlantis is at the end of the PATH as follows:
C:\Program Files (x86)\Atlantis

I have a memory stick with a file called 5-Act.docx.
The .docx file is in Roland\Docs on the memory stick.
No copy of Atlantis is on the memory stick.
Memory stick is plugged into a port and designated as E: drive.

QUESTIONS
Will Atlantis open the file on E: if I change to the E:\ prompt?
Will Atlantis open the file without special parameters in the command?

ILLUSTRATION

The PATH
Image

The COMMAND LINE Commands
Image

RESULT

Atlantis opens the local file as designated in the simple DOS command.

NOTES
I conducted the test on one of my laptops, which uses Windows 7 Professional. Unfortunately, my Windows 10 desktop has all the USB ports in use.

I did not test this, but I wonder whether the use of the short expression for putting Atlantis on the Path

C:\PROGRA~2\Atlantis\awp.exe (short path)

makes a difference. I also did not include the 'awp.exe' in the Path; I just gave the direction to the Atlantis directory.
Robert
Posts: 1900
Joined: Fri Aug 15, 2003 8:27 pm

Post by Robert »

This gave me quite a sweat but I think I got to the bottom of it.
Roland, you are right in every way, except that Atlantis will only open the target file if Atlantis.exe is not already running.
In other words, if one instance of Atlantis.exe is already running, and I use awp 1b.docx on the command-line, I systematically get a message from Atlantis saying that it could not open the following file:
C:\Users\<user’s name>\Documents\Atlantis\Documents\1b.docx
However, if no instance of Atlantis.exe is running, and I use awp 1b.docx on the command-line, that file opens normally in Atlantis.
Windows (and Atlantis) work in mysterious ways!
Post Reply