UiPath - Issue embedding double quotes around String - uipath

I have come across a peculiar problem while running a workflow on a different laptop. The workflow was running without issues on the original laptop that was used to design the workflow.
The issue seems to be simple and is with a “type into” activity which types into the bing webpage search box.
I need to embed a string within double quotes. This was working as expected on the original laptop but when I tried to run this in a new laptop, there seems to be some special characters appearing instead of double quotes.
Below is the string that should be typed into the search box.
“site:” + URL.ToString.Substring(4)+" “+”"“AS400"”"
A correct sample string typed in should look like the below.
site:bfa.ao “AS400”
But instead, it is getting typed as shown in the image below.
As can be seen, the first “A” character in the string gets typed into as Ä and the double quote is missing.
Please help why this is happening so.

You can try to use:
Chr(34) as double quote char symbol.
So in you case it would be:
"site:" + URL.ToString.Substring(4) + " " + Chr(34) + "AS400" + Chr(34)

Related

Ui path error while writing cell activity

Expression Activity type 'VisualBasicValue`1' requires compilation in order to run. Please ensure that the workflow has been compiled.
how to solve this error
This can happen when a string with quotes is copied from a RTF formatted app, such as Microsoft Word. The " quotation character is not the code version. Try deleting the current assignment in the write cell activity and type manually so that the quotes (") are of the right type. Notice the slanted quotes vs. the straight quotes in the two examples below:
“This is a quote from an RTF app”
"This is a quote from a code editor"

Populating an email with data from IBM i (AS400) screen

I'm trying to grab data from an AS400 screen & populate an email using that data but seem to have bumped into something I'm struggling to overcome. Here's a slice of what I have so far:
Dim polNo
polNo = GetText(10,18,10)
Dim wsh
Set wsh=CreateObject("WScript.Shell")
subSub1_()
sub subSub1_()
// Just doing this to check the text I have
SendKeys(polNo)
// Sent the eMail with the text
wsh.Run "mailto:testing#somemailbox.com?Subject=" & polNo
end sub
With the above, the resulting email subject line takes only the first word upto the first space. From what I've found, this is a parsing issue & have discovered the following line that should help.
polNo = Chr(34) + Replace(polNo,chr(34),chr(34)&chr(34))
The above line places all of the text in quotes (I know this because my SendKeys line now shows the GetText result with a " at the start.
The issue is when I reach the mailto line as Outlook pops up a window saying:
"The command line argument is not valid. Verify the switch you are using."
My end result will be an email that has a subject & a body with text taken from various parts of the screen.
Solved: Thanks to dmc below, he started me on the right line.
However, the solution was not to use Chr(34) but to use something as simple as:
polNo = Replace(polNo," ","20%")
Although it might not look like it, you're constructing a URL. As such, the contents of that URL must be URL Encoded. Certain characters can't be included in a URL, including a space. Those characters are represented with a percent sign followed by the ASCII code of the character in hexadecimal. For example, a space is changed to %20.
See the link below for a VBScript routine that will URL encode and decode strings.
http://www.justskins.com/forums/wsh-equivalent-of-server-38778.html
Edit: Although this is commonly known as URL encoding, the thing you're constructing is technically a URI. Wikipedia has a good page that explains further.

Extracting text between backslashes in webload (or other similar applications?)

In Webload, there is a function extractValue("start","end", source, 1) that basically just extracts any values between a specified start and end point. So for example if you have abcdefg and you want to extract cde you could do extractValue("b","f", source, 1) etc. However, the issue i am having is because webload seems to use backslashes as a marker for quotations, so for example if you had something like
ab"cde"fg you would need to use something like extractValue("b\"","\"f", source, 1) if you only wanted to extract cef.
Now my issue is I have a string like abcde\ and I want to extract only cde, I try something like
extractValue("ab","\", source, 1), however when doing this webload assumes I am not ending my string since it interprets the second quotation in "\" as part of the string.
Does anyone know how exactly I should deal with this if I want \ to be interpreted as part of a string and not as the indicator for the quotation?
Thanks
try using two backslashes like extractValue("ab","\\", source, 1), this is another example for using escape character using backslash in extractValue function
myTitle = extractValue( "<\title>", "</title>",
MyFrame.document.wlSource) backslash title is the title tag..i dont know why it is not getting displayed in the answer.

Printing printing variable in single quoted string Ruby

I am attempting to send a tweet to twitter using the twitter_oauth gem with the following code:
client.update('.# #{tweeter}, have a nice day!')
Because of the single quotes I cannot get the variable to display but the tweet will not send if single quote are not used. Does anyone have any suggestions as to how to get this to work? thanks
Just replace the ' with ", single quoted strings don't do variable substitution and the other neat things of double quoted strings. They exist because of those missing features they are faster to parse.
If the tweet doesn't work despite using " then the problem is likely that the variable tweeter contains characters that are not allowed or in some other way invalid (maybe requiring some sort of escaping, e.g. URL or XML escaping).
Have you tried the old, java-esque way:
client.update('.# ' + tweeter + ', have a nice day!')
Or using a temporary variable:
message = ".# #{tweeter}, have a nice day!"
client.update(message)

How to escape slash (/) in VBScript?

How do you escape the forward slash character (/) in VBScript? For example, in the following string:
bob = "VU administration/front desk"
You don't escape it: it doesn't mean anything special in php or vbscript, and therefore doesn't need to be escaped. The only character you need to escape in vbscript is the double quote, which escapes itself:
MyString = "He said, ""Here's how you escape a double quote in vbscript. Slash characters -- both forward (/) and back (\) -- don't mean anything, even when used with common control characters like \n or \t."""
Similarly, in php a backslash escapes itself, but a forward slash doesn't need any special handling.
This is so wrong I have to comment on it. The question is about VBScript, not PHP, so who cares what PHP does with a slash? In VB, the forward slash / does have special meaning. The character / represents DOUBLE. If your code editor displays this character as DOUBLE or you get an error about converting to DOUBLE when you don't mean to convert to DOUBLE then you probably need to fix something in your string.
For instance, VB treats the forward slash / in this query string as DOUBLE and the program would fail here because you cant convert select replace(convert(char(10),pih.updateon,111), from text to double.
Dim sQuery As String = "select replace(convert(char(10),pih.updateon,111),"/","-") as stopdate from myTable"
The problem however will not likely be an issue with escaping a slash. Chances are you goofed somewhere else. In this case, if you typed the string correctly, it would look like this:
Dim sQuery As String = "select replace(convert(char(10),pih.updateon,111),'/','-') as stopdate from myTable"
Hope that example helps understand where you might be going wrong if you are having issues with slashes.
Addendum: In VBScript and VB, the chief difference being VB is compiled and VBScript is interpreted, the syntax in this case is handled the same way.
d-bo

Resources