WriteLn not working on Windows Server - SOLVED!

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

WriteLn not working on Windows Server - SOLVED!

Post by mightycpa » Thu Jan 19, 2017 8:39 pm

Hi,

Why doesn't this work?

Here's my simple code:

Code: Select all

// COMPILE_OPTS|E:\Documents\BPS\SST2\sst_checker\WriteLine.exe||CONSOLE=1|INCLUDES=1||RUNTIMES=1|BMPS=1
//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1

//Let>cdir=%CWD%

ReadIniFile>%SCRIPT_DIR%\WriteFile.ini,Path,WritePath,mypath
ConCat>%mypath%,TEST_FILE.TXT
//Mdl>%mypath%
WriteLn>TEST_FILE.TXT,my1,The ini path is %mypath%
Wait>2
WriteLn>mypath,my2,Current Working Directory is %cwd%
Wait>2
WriteLn>mypath,my3,Current User is %user_name%
Wait>2

SoWriteLn>Return Code 1 is %my1%
SoWriteLn>Target file is %mypath%
SoWriteLn>Return Code 2 is %my2%
SoWriteLn>Return Code 3 is %my3%
SOWriteLn>Current Working Directory is %cwd%
SOWriteLn>Current User is %user_name%
Wait>5
It works on my local machine (Windows 7, 64 bit) uncompiled. It works on my local machine compiled. It appears to work on Windows Server 2008, but the last two WriteLn statements don't actually write to the file, even though they both return code 0.

Image
Image
Last edited by mightycpa on Fri Jan 20, 2017 6:33 pm, edited 1 time in total.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: WriteLn not working on Windows Server 2008 R2 Enterprise

Post by Marcus Tettmar » Fri Jan 20, 2017 10:55 am

Odd. Are you sure something else isn't deleting the file? Or overwriting it? Another process running?

What if you add this immediately after your WriteLn lines to see what is in the file at that point:

ReadFile>mypath,allText
MessageModal>allText

Try it immediately after each one maybe.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: WriteLn not working on Windows Server 2008 R2 Enterprise

Post by mightycpa » Fri Jan 20, 2017 4:07 pm

Did it. Not sure what I expected, but it wasn't this. It might be worth mentioning this is through RDP, and this is a virtual machine. There's lots of stuff running, but this is running only once, and nothing else would write to this folder.

The pattern is
Current Working Directory
Current User

In each MsgBox, user FSS... appears 4 times, then g... appears 14 times
after that
Current Working Directory
Current User is FS...
then the second one adds
Current Working Directory
then the third one adds
Current User is g...

You can see it here: http://i67.tinypic.com/msons4.png
Image
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: WriteLn not working on Windows Server 2008 R2 Enterprise

Post by Marcus Tettmar » Fri Jan 20, 2017 4:45 pm

This appears to show that the file IS being written to.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: WriteLn not working on Windows Server - SOLVED!

Post by mightycpa » Fri Jan 20, 2017 6:35 pm

Oh, Marcus, I'm dumb as a post sometimes. :oops:

The program writes to two folders, as it's supposed to... 1 line to the file where it is executed, and the 2nd to the one specified in the ini file.

The multiple entries are merely the number of times I've run it.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts