Print Page | Close Window

Script not working on Windows Server

Printed From: Rocket Software
Category: AccuTerm Knowledge Base (read only)
Forum Name: Scripting & Automation
Forum Description: Customize and control AccuTerm using scripts and automation
URL: https://forum.asent.com/forum_posts.asp?TID=2724
Printed Date: March 28 2024 at 7:25am
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Script not working on Windows Server
Posted By: jimh140
Subject: Script not working on Windows Server
Date Posted: September 17 2019 at 7:31am
I am trying to run a script from a basic program to copy a file from one location to another. I have the script working successfully on a Windows10 system but it fails to work on a Windows 2016 server. I've checked permissions on the folders and users have full control on the folders copying from and copying to. Since it works on a windows 10 system, I believe it's some setting on the server perhaps blocking it or perhaps some setting in the AccuTerm on the server?

It is interesting that I can from a windows command line run the copy successfully.

The command is simply -

CMD = 'copy ""C:\Demo\pdf26.pdf"" ""C:\Customer\C7102\pdf26.pdf""'
*
SCRIPT = 'On Error Resume Next':CHAR(25)
SCRIPT = SCRIPT:'x=Shell("':CMD:'",0)'
CRT CHAR(27):CHAR(2):'P':SCRIPT



Replies:
Posted By: Shrek59
Date Posted: September 17 2019 at 2:12pm
Where are you expecting the copy to occur? An AccuTerm script always runs on the client.

Is your Windows 10 system both the server and the client? If so, that is why it works there. (As I expect that the Server 2016 is acting solely as a server, and you are using Windows 10 as the client).

If you want to copy stuff on the server, then make sure you run the copy commands on the server (not the client). Usually, this is done by shelling out to the O/S and then using the O/S copy command.

HTH

Brian


Posted By: jimh140
Date Posted: September 18 2019 at 7:15am
In this case I'm actually running AccuTerm on the server, it's kind of a demo/development system. I have a separate system on Windows10 where the script works but on the system on the server it doesn't. So I'm actually working on the server in AccuTerm.


Posted By: jimh140
Date Posted: September 18 2019 at 9:20am
So I figured out the problem but wondering about a solution. The files being copied had spaces in the names and that was causing a failure on the copy, it seems Windows10 interprets the copy differently then Windows Server 2016.

A command like

x = shell("copy ""C:\Scans\Test Page.pdf"" ""C:\Vendor\Test Page.pdf""",0)

works on Win10 but not WinServer2016

Changing it to

x = shell("copy "C:\Scans\Test Page.pdf" "C:\Vendor\Test Page.pdf"",0)

causes an 'Expecting ')' error

and using

x = shell('copy "C:\Scans\Test Page.pdf" "C:\Vendor\Test Page.pdf"',0)

gives the same ')' error

I can put this in a batch file and execute that and it will work

Just wondering how you can do a copy from a shell command with file names containing spaces


Posted By: Shrek59
Date Posted: September 18 2019 at 2:11pm
So, what you are really wanting is to copy a file (or files) on the SERVER. If that is the case, I wouldn't use AccuTerm scripting - even if the client IS the server - simply because you are operating in a "special case" instance. Other users who connect to the server from remote clients will have the copy occurring on their LOCAL machine rather than the server where you intend the copy to take place.

Spaces in file names always make things problematic. I would write a batch file with a command like:

  COPY srcpath:srcfile destpath

and then EXECUTE that batch file from within your DB environment (using whatever syntax is appropriate). When it comes to dealing with spaces, it is always easier to get that working as DOS command and execute that command in a batch file, than to "escape" the command for direct execution.

Cheers,

Brian



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net