I have text file in VB6 Application resources, and I am trying to read the text in it.
How to do that? I have been searching for hours without a proper solution. Somebody please help me.
My code is:
Private Sub Command1_Click()
Dim URL As String
URL = LoadResString(101)
MsgBox URL
End Sub
This maybe explains it more: http://i.imgur.com/wGnWCBb.jpg
Is this even possible? Somebody please spoonfeed me, I would appreciate that a lot.
I am trying to read the string from resource to a variable(string) and then prompt it with messagebox.
Some simple solution would be great. Also, if this is possible with FindResource API, please tell me how or point me to the right direction.
I had to do something like this many years ago.
I used s = StrConv(LoadResData(resId, resType), vbUnicode). The resource was an ANSI (non-unicode) file.
resType was a custom type I just made up when I saved the resource.
I had an issue with a double null that got appended at the end of the text, and which had to be removed. I can't remember the exact reason why that happens, but I presume it has to do with the resource being stored as a double-null-terminated list of C-strings.
If I had to guess, you'll have better luck with LoadResData(). Make sure to use both parameters (the id and type ones).
Related
When I make the "Read Cell" in "Excel application scope", I tried to output the read data from Excel by using "Write Line". However, It's not working and it ouput the error as in the Title. Could you someone make it up?
I had the same issue. I'm using the LookupDataTable activity. In my Excel file I have a mix of Strings and Integers. But somehow I also got the error:
NotSupportedException: StringConverter cannot convert from
System.Double.
I solved it by changing the variable from String to GenericValue.
I also tried to give it the Double type, but it didn't work because I think I have different types in the column.
Try this maybe be it will help you to check out
Convert.todouble
so I would like to ask you for help.
I was scooping and sweeping the internet so long for that and I did not find how to do it. What I just produced is totally wrong and my professor did bad time with formulating the task. it is entry level task on university I have already finished the hardest ones, but this one I just dont get what he wants
Translation is made by me so it might be little bit off, but bear with me, please.
"Create file "linewriter.py". This file will have function writeTextToFile, that will accept one parameter and on end is also one parameter. Function will take the parameter on input and chain it with variable STATIC_TEXT (stated bellow). Queue of chaining will be as follows: 1st static text and then argument of function. This way chained input will write to file of any given name and a the name of this file will be returned as input parameter of function.
STATIC_TEXT: “This is my static text which must be added to file. It is very long text and I do not know what they want to do with this terrible text. ”
...
What? I really don't get what he want's from me. Can you help? Thank you all :)
STATICKY_TEXT = "This is my static text which must be added to file. It is very long text and I do not know what they want to do with this terrible text.\nNew Line! "
saveFile = open ("exampleFile.txt","w")
saveFile.write(STATICKY_TEXT)
saveFile.close()
solved it :) but I COULD not figure it out for days haha ... silly me
variableName = driver.findElement(By.XPath(".//*[#id='T_F2']/fieldset/div[1]/div/div[4]/span[2]"))
Running the above always seems to lead to the error:
Why is this? I always see other people using findElement By XPath. If it helps, I generated about half of my code using Selenium's 'record' feature. I then converted the code into 'VBA/Webdriver' before pasting it into Excel to use as a Macro.
What exactly is wrong with my code? I have used findElement a number of times before, so I'd have to guess that the problem is with the By.XPath part of my code... Is there any way around this?
Edit: Even variableName = driver.findElementsByXPath(".//*[#id='T_F2']/fieldset/div[1]/div/div[4]/span[2]") leads to the error 'Invalid procedure call or argument' even though it looks fine to me.
Try:
variableName = driver.findElementByXPath("//div[#id='T_F2']/fieldset/div[1]/div/div[4]/span[2]")
Notice that I removed the . in the beginning of the xPath and replaced * with div. Also, you're missing something at the end. You are just declaring the path here and not really getting a value.
EDIT: Referring to just the xPath is not usually enough. Do you want to perform an action on it, get the text inside, the tagname, etc.?
EDIT2: Testing to get the .Text attribute returns a "findElement By XPath not supported in Selenium VBA?" message.
Here's what works for me:
Dim variableName() as variant
variableName = driver.findElementsByXPath("//div[#id='T_F2']/fieldset/div[1]/div/div[4]/span[2]").getdata
Notice it's "find elements [plural] by XPath". This creates a two-dimensional array. variableName(1,1) will have the data you're looking for.
(I know it's been more than 6 years, but it's my first contribution and I can't resist! Maybe that can help someone else)
You have to initialise the following:
Dim By As New By, variableName As WebElement
and because variableName is an object, it has to be declared, as follows:
Set variableName = driver.FindElement(By.Xpath(".//*[#id='T_F2']/fieldset/div[1]/div/div[4]/span[2]"))
I am trying to write a script for Linux on tcsh. I have not written a script since maybe 98 on Unix and that was very basic stuff.
I am trying to take a string and find sub strings in it. For example in a very long string that is a devices status I'd like to find a sub sting "the status: " and if said sub string is found read the next word(string) following that sub string.
Basically I have a variable called INFO that is populated after sending out a command and I want to search it. I can of course loop through the whole thing but I know there are shorter ways of doing so, I just can't remember how anymore.
Plus if anyone knows of a decent source for script writing info that would be of use to me.
Hope this makes sense. PS If it were my choice I'd write this in straight up code and be done yesterday, but not my decision.
Thanks.
Here's a good tutorial source, it has several sections: http://www.dreamsyssoft.com/unix-shell-scripting/tutorial.php
I'm currently finishing a piece of software a now gone co-worker started.
The app is coded in VB6 and uses a 3rd party ActiveX component to act upon a 3rd party system. Our solution is basically an integration between their company's software and ours.
The issue I'm having is that there's a method call that fails consistently, even though it's passed perfectly valid parameters on our side (it's a login method). However, when I look at the trace their application offers, I see that instead of the username I specify, it tells me (roughly) "User '⚠⚠⚠' can't login".
I figured it was likely to be an encoding issue as the ⚠ character replacing the characters I give it to log on seem to be there because the characters are unknown, but nothing I did could fix it.
Anyone know of an issue with VB6 communicating with ActiveX components like this? Or anyone have an idea what I could try? I'm at a loss here and if the issue is on their side, it'll be a pain to get it fixed as we don't have their source code.
Thanks in advance.
There are a couple of ways of passing strings. Aside from the obvious one of passing a string as in
DIM u As String
DIM p As String
u = "Username"
p = "Password"
Set objIRC = objRCL.Login(u, p)
there's also the possibility that .Login is expecting pointers to String, in which case code
Set objIRC = objRCL.Login(StrPtr(u), StrPtr(p))