Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-23-2006, 06:27 PM
pjaquiery pjaquiery is online now
Registered User
 
Join Date: 01-20-2003
Location: Dunedin, New Zealand
Posts: 114
Odd JScript behaviour

If I use

["/samplestring/".replace (/[[\\\/]]$/, "")]

as the Value: for a Set Macro step the macro is set to

/samplestring/

and is also shown in the mouseover tool tip with shift down. If I use the immediate pane in the Script Editor to evaluate:

"/samplestring/".replace (/[\\\/]$/, "")

I get:

/samplestring

What am I missing here?

Update: replace (/(\\|\/)$/, "") works around the problem

Last edited by pjaquiery; 01-23-2006 at 06:44 PM.
Reply With Quote
  #2  
Old 01-24-2006, 11:39 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,687
The first result is due to how macros and script are processed in a field values (see http://www.kinook.com/Forum/showthre...?threadid=1383). When evaluated (in the build or with Shift down over a field), the by-design behavior applies to the expression containing nested literals [[...]].

But when code is evaluated in the Immediate window, this extra processing is not performed (the value entered is treated as the script code to evaluate and no additional processing of nested script expressions or literal [[ ]] is performed).
Reply With Quote
  #3  
Old 01-24-2006, 02:46 PM
pjaquiery pjaquiery is online now
Registered User
 
Join Date: 01-20-2003
Location: Dunedin, New Zealand
Posts: 114
I keep getting bitten by this don't I?

Is it possible (and sensible) to detect the context where this happens and generate a warning?
Reply With Quote
  #4  
Old 01-24-2006, 03:52 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,687
There's no easy way to do that without potentially breaking other existing projects. It is doing the wrong thing in your situation, but it's possible for the result to be correct in other scenarios. For compatibility, the evaluation still needs to return the value it currently does (and not an error message instead). You could run all your .bld files through the attached project to identify problem field values (I apologize for using *spit* VBScript for the sample :^).
Attached Files
File Type: bld findnestedlit.bld (2.4 KB, 650 views)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 05:17 AM.


Copyright 1999-2019 Kinook Software, Inc.