| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 38283 | 2003-10-02 10:53:00 | Help with vbscript | Mike (15) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 179850 | 2003-10-03 06:21:00 | Maybe the "+" in K's example should be a "&". :D Just maybe ... perhaps they do use a different operator to append a string ('+ "something" ') and a variable (' & date '). (Maybe I'm oldfashioned, but I'd use a real programing language. ]:) ) |
Graham L (2) | ||
| 179851 | 2003-10-05 19:13:00 | Thanks Graham :) I tried different combinations of the & and the +, but nothing successful. Mike. |
Mike (15) | ||
| 179852 | 2003-10-05 22:56:00 | I'm just trying to understand VBScript and how it knows that it's reached the end of the statement. If UCASE(Mid(pTextElement.Text, 1, 5)) = " INFO: " Then pTextElement.Text = ( " Name: " & UserName & " Date: " & Date & " FILE: " & GetMXDName) End If Also I believe " concatenation " (method of joining strings together) can be done with either + and & so replacing them with either should have the same result, although which is the best method I have no idea, I'd stick with & unless stated otherwise since it seems this is how it's been laid out. If that above method doesn't work then try If UCASE(Mid(pTextElement.text, 1, 5)) = " INFO: " Then DIM InfoString InfoString = ( " Name: " & UserName & " Date: " & Date & " File: " & GetMXDName) pTextElement.text = InfoString End If |
Kame (312) | ||
| 179853 | 2003-10-06 00:08:00 | Kame, It still just displays "Name: Mike" - or whichever is first in the string. I tried both of your suggestions with the same result. Mike. |
Mike (15) | ||
| 179854 | 2003-10-06 00:44:00 | See if this works. If UCASE(Mid(pTextElement.Text, 1, 5)) = " INFO: " Then pTextElement.Text = ( " Name: " " & UserName & " Date: " " & Date " & " FILE: " " & GetMXDName) End If What are you using to run VBScript? I know using it with HTML but this seems like an external program. |
Kame (312) | ||
| 179855 | 2003-10-06 01:03:00 | It highlighted that in red (as code it didn't like) immediately :) I'm using an application called ArcMap - the VB is an internal script for adding date, name, and filename to the map before it's printed. Mike. |
Mike (15) | ||
| 179856 | 2003-10-06 01:20:00 | Yea I knew it'd throw a wobbly on that but I didn't reply back, as I was wondering how you used VBScript, ArcMap... hmm... probably means I can't use WSH to process it then, that way I can test my own errors out. | Kame (312) | ||
| 179857 | 2003-10-06 01:45:00 | WSH? I'm not too sure how it uses the VB etc, so I wouldn't know if it can be tested anywhere else. Mike. |
Mike (15) | ||
| 179858 | 2003-10-06 01:58:00 | All the examples I try in VBScript HTML or WSH seem to work, WSH is Windows Script Hosting, basically used to run VBScript and Window Script for Windows. But my examples aren't as complex, but the method is similar. Unless .text is limited in size? I wonder if .caption would work |
Kame (312) | ||
| 179859 | 2003-10-06 02:27:00 | > All the examples I try in VBScript HTML or WSH seem > to work, > WSH is Windows Script Hosting, basically used to run > VBScript and Window Script for Windows. > But my examples aren't as complex, but the method is > similar. Unless .text is limited in size? I wonder > if .caption would work I don't think .text is limited in size, as the result can be very large (the file one can be 100+ characters, when network drives and folders etc. are taken into account. If that's that .text looks at (I don't know). Mike. |
Mike (15) | ||
| 1 2 3 4 | |||||