Page 2 of 2 <12
Topic Options
#186455 - 2008-03-24 11:01 PM Re: File Copying Script assistance [Re: Mart]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Try using strings instead of vars.

Use N: "\\THC-GA\Public"
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#186456 - 2008-03-25 12:11 AM Re: File Copying Script assistance [Re: DieselDoc]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
"You there! In back!! Pay attention!
Now class, lets get back to the topic at hand - Methods of Debugging scripts."

;\)

A common way of debugging is to place the commands in quotes, and stick a CRLF (?) at the end so you see what the script is trying to do, rather than guessing why the script is throwing errors. As you pointed out earlier, a single character can be enough to cause a problem, but how will you know which char, or whether it is an extra or missing char?

Also - the syntax displayed in my example should be able to be executed at the command line after "net" - for example:
"Use D: " $mapstring ?
displays
Use D: \\server\share

You could copy that screen output, type "Net " and paste the copied output, resulting in
Net Use D: \\server\share

Does the native O/S command work as expected? If it doesn't, the Kix commands certainly can't.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#186458 - 2008-03-25 12:33 AM Re: File Copying Script assistance [Re: DieselDoc]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sorry Glenn, got caught sleeping.
 Originally Posted By: DieselDoc
Getting the following:

ERROR : error in USE statement!
testkix.kix
Line : 57


Funny thing is that I'm getting that error even if I replace the line:

Use N: $public ;MAP Public Share

With:

Use N: "\\THC-GA\Public" ;MAP Public Share
It sounds like there is some extraneous character in your code or you have miss-matched or curly quotes. Time to take parts of your code and run then as separate scriptlets to narrow it down.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#186459 - 2008-03-25 01:59 AM Re: File Copying Script assistance [Re: Les]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
LOL - I was referring to DieselDoc with my classroom reference! (although I guess you might have been snoozing a bit) \:\)

Glenn

PS - DieselDoc - Something to think about...

The line number where the error triggers may NOT be the line with the error! If you have a mismatched quote or paren on an earlier line, Kix will keep reading thinking that the logic should continue until it encounters something it just can't process, and that's where the error is thrown.

As Les suggests, comment out blocks of code to isolate the issue. Using block-comments to surround a supposedly working block will sometimes comment-out mismatched items, allowing failing code to suddenly work. Then you can focus your attention inside the commented code. The idea is - reduce the things you're troubleshooting.

Also, Les' reference to "curly quotes" means "typographic" quotes, which curve in and out, as opposed to double-quotes that Kix needs, which are plain vertical. Outlook and Word often convert "normal" quotes to the curly style. Be sure by editing in Notepad and replacing the quotes with the proper quote char.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#186495 - 2008-03-25 09:46 PM Re: File Copying Script assistance [Re: Glenn Barnas]
DieselDoc Offline
Fresh Scripter

Registered: 2008-03-19
Posts: 13
Just don't call me grasshopper! Haha - I have to say thank you to all of you guys, not just for the info but also for putting me on the road to being able to troubleshoot this stuff on my own.

The script is working!!! WOOO HOOOO!

I started pulling out lines or sets of lines and running them from a separate kix file. The output syntax was a big help too. And I didn't even think about the link to the DOS commands.

The problem was indeed on another line, for the word /PERSISTANT is spelled with an two E's. Who would've thought...haha.

Use * /DELETE /PERSISTENT ; Line 56

And also there was a quote missing off the end of IT in Line 70:

Case $service ="~IT"


Here's the final script for the rest of you noobs:

 Code:
;  TEST.KIX

If NOT @LOGONMODE
	     Break On
EndIf

$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
	
;Set Variables
dim $os,$public,$service,$assigned,$Pserver,$department
CLS
$OS=@dos							;OS Versio
$public="\\THC-GA\Public"				;Public Share
$service=@comment					;Department assigned from comment field
$Pserver="\\THC-GA\"					;Server for User Accounts
$department=$Pserver + $service			;Departmental Share
;$personal=$Pserver + @userid+"$"			;Personal Share

;SetTime "\\thc-ga\"					;Unless you have NT / 95 not needed
;******************************************************************
;***	BEGIN Instructions by Department 
;******************************************************************

Use * /DELETE /Persistent
Use N: $public						;MAP Public Share
Use O: $department					;MAP Department Share


Select
	Case $service = "~AHPs"
		Use T: "\\Cs-cb\Transcription"

	Case $service = "~Clinical"
		Use T: "\\Cs-cb\Transcription"

	Case $service = "~Diagnostics"
		Use T: "\\Cs-cb\Transcription" 

	Case $service ="~IT"
		Use S: "\\THC-GA\Software"

	Case $service = "~MedicalRecords"
		Use U: "\\cbs-cb\Transcription"

	Case $service = "~Physicians"
		Use T: "\\Cbs-cb\Transcription"
EndSelect

:REGISTERED-OWNER
$ReturnCode = WriteValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","RegisteredOrganization","Napa Valley Cardiovascular Associates, P.C.","REG_SZ") 
$ReturnCode = WriteValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","RegisteredOwner","The Health Center","REG_SZ") 


;******************************************************************
;***	BEGIN Instructions by Group 
;******************************************************************
:SOFTWARE

If InGroup("APP-PEACHTREE")
	Use Q: "\\APP01\PEACHTREE"
EndIf

If InGroup("APP-SOLOMAN")
	Use S: "\\SUPERIOR-FS\SOLOMAN"
EndIf

If InGroup("APP-APD")
	Use R: "\\DENARI\EZTIMEG"
	Use T: "\\DENARI\TIMEOUT"
EndIf

If InGroup("APP_HOLSTER")
	Use U: "\\THC-GA\HOLSTER DAT"
EndIf

; **Adding icon to group below's Desktop**
If InGroup("APP-Allscripts")
	If Not Exist (%UserProfile% + "\Desktop\Allscripts.rdp")
		Copy "\\Sec01\deploy\Shortcuts\Allscripts.rdp" %UserProfile% + "\Desktop"
		? "Return code was :" + @Error + " -Descriptive text " + @serror ;remove after testing
	EndIf
EndIf

;******************************************************************
;***	END Instructions by Group
;******************************************************************

;******************************************************************
;***	BEGIN Miscellaneous Instructions 
;******************************************************************

; **Clears the C:\TEMP Directory** [BEGIN]

Go C:
Del "C:\TEMP\*.PDF"
Del "C:\TEMP\*.DWG"
Del "C:\TEMP\*.DOC"
Del "C:\TEMP\*.BMP"
Del "C:\TEMP\*.JPG"
Del "C:\TEMP\*.TXT"
Del "C:\TEMP\*.XLS"
Del "C:\TEMP\*.PPT"
Del "C:\TEMP\*.MDB"
Del "C:\TEMP\*.ZIP"
Del "C:\TEMP\*.EXE"


;******************************************************************
;***	END Miscellaneous Instructions 
;******************************************************************




Exit


THANK YOU!!!

Top
#186496 - 2008-03-25 10:33 PM Re: File Copying Script assistance [Re: DieselDoc]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Well, there's this old proverb..

"If you give a man a script, he'll be back for more, but teach him to script, he'll..."
(Damn, where are those fish when you need them?)

- well - it loses a lot in the translation (probably from Fortran IV to KixForms)

Glad you found the problem, and found Kix!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#186497 - 2008-03-26 02:56 AM Re: File Copying Script assistance [Re: Glenn Barnas]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
LOL
Give a man a fish and he'll be back every day for more.
Slap him with a fish and he goes away forever.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 525 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.061 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org