Page 1 of 1 1
Topic Options
#210239 - 2015-05-07 12:59 PM Problem with use command and variables containing quotation marks
thomasdin Offline
Just in Town

Registered: 2015-04-07
Posts: 3
Loc: Germany
Hello,
i am new to kix and tried to writen an logon script which reads groupmembership and then connect via use serveral drives. All of this went well. The Problem begins when i want to set the var which contains unc-path in quotation marks. I tried serveral ways but couldn't figure out how to solve it. Everytime it try to put the var in quotation marks it fails with: error in use Statement.


Here an Example:

SETCONSOLE("show")

$drive = g:
$path = '\\server\share$\folder'

use $drive Chr(34) + $path + Chr(34)
?@error
? @serror


Thanks in advance and sorry please excuse my poor english

Top
#210240 - 2015-05-07 01:07 PM Re: Problem with use command and variables containing quotation marks [Re: thomasdin]
thomasdin Offline
Just in Town

Registered: 2015-04-07
Posts: 3
Loc: Germany
btw i also tried
$path = '"' + $path + '"'
to no avail

Top
#210241 - 2015-05-07 01:43 PM Re: Problem with use command and variables containing quotation marks [Re: thomasdin]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
What is the path it showed?

You should always have your strings quoted, so that is not the issue here.
Just to rule out variable parsing, use this format:
$path = '\\server\share$$\folder'
_________________________
!

download KiXnet

Top
#210242 - 2015-05-07 01:44 PM Re: Problem with use command and variables containing quotation marks [Re: thomasdin]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Your problem is probably the $ inside of the path, which is a special character in Kix. Simply put the following at the top of your script to tell kix to ignore all $'s that are in strings...

$nul = SetOption("NoVarsInStrings", "On")

OR...You can also use double $$ to escape the $ character. So your path would become...

$path = '\\server\share$$\folder'

Either way should solve your issue.

Top
#210243 - 2015-05-07 01:47 PM Re: Problem with use command and variables containing quotation marks [Re: ShaneEP]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Also, another problem...Your use statement is missing a space.

use $drive Chr(34) + $path + Chr(34)

should be

use $drive+" "+Chr(34)+$path+Chr(34)

or even

use $drive+' "'+$path+'"'

Top
#210244 - 2015-05-07 03:23 PM Re: Problem with use command and variables containing quotation marks [Re: ShaneEP]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Shane? Your last examples actually should never work.
_________________________
!

download KiXnet

Top
#210245 - 2015-05-07 04:33 PM Re: Problem with use command and variables containing quotation marks [Re: ShaneEP]
thomasdin Offline
Just in Town

Registered: 2015-04-07
Posts: 3
Loc: Germany
Thank you Shane and Lonkero for you suggesstion. My Problem is solved.
But as an sidenote i never had an issue with the missing space, my script works fine without it.
cheers thomas


Edited by thomasdin (2015-05-07 05:04 PM)

Top
#210246 - 2015-05-07 06:51 PM Re: Problem with use command and variables containing quotation marks [Re: thomasdin]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Forget the comment about missing space... He was still asleep or something.
_________________________
!

download KiXnet

Top
#210247 - 2015-05-08 02:47 AM Re: Problem with use command and variables containing quotation marks [Re: Lonkero]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Sorry. I recently started working overnights. The closer it gets to 7 am, the more delirious I get!
Top
#210248 - 2015-05-09 11:01 PM Re: Problem with use command and variables containing quotation marks [Re: ShaneEP]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Glad to know it's not just me that suffers from that! \:D
_________________________
Actually I am a Rocket Scientist! \:D

Top
#210253 - 2015-05-11 10:07 PM Re: Problem with use command and variables containing quotation marks [Re: Glenn Barnas]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
that's just nature calling ;\)
_________________________



Top
Page 1 of 1 1


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

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.07 seconds in which 0.033 seconds were spent on a total of 13 queries. Zlib compression enabled.

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