Micro Focus QTP (UFT) Forums
problem in assigning value in a script - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: problem in assigning value in a script (/Thread-problem-in-assigning-value-in-a-script)



problem in assigning value in a script - vijay44 - 02-01-2010

Hi,

Code:
Function SetSource
Set WbEdit = Description.Create()
WbEdit("micclass").Value = "Link"
WbEdit("name").Value = "C"
WbEdit("href").Value=javascript:Copy"('nessusId','0','4')"

Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
NumberOfEdits=AllWbEdit.Count
msgbox(NumberOfEdits)
For i=0 to (NumberOfEdits-1)
    if AllWbEdit(i).GetRoproperty("href")<>javascript:Copy"('sourceName','0','2')"  then
        AllWbEdit(i).Click
   End if
Next
End Function

I am getting syntax error.
when observed with object spy:The objects href property:

javascript:Copy('sourceName','0','2')

when i directly use this value its treating as comments.
Any help will be really appreciated.
Regards;
Vijay


RE: problem in assigning value in a script - Saket - 02-01-2010

whenever you assign a string value use double quotes (")
in this use it like
"jCopy"("'sourceName','0','2'")" "


RE: problem in assigning value in a script - vijay44 - 02-01-2010

Function SetSource
Hi,

Code:
Set WbEdit = Description.Create()
WbEdit("micclass").Value = "Link"
WbEdit("name").Value = "C"

Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
NumberOfEdits=AllWbEdit.Count
msgbox(NumberOfEdits)
For i=0 to (NumberOfEdits-1)
    if AllWbEdit(i).GetRoproperty("href")<>"javascript:Copy"("'nessusId','0','2'") " "  then
        AllWbEdit(i).Click
   End if
Next
End Function
I am getting syntax error, end of statement required.
Any help will be really appreciated
Regards;
vijay


RE: problem in assigning value in a script - Saket - 02-01-2010

very sorry, it was my mistake.
this should work-
"jCopy('sourceName','0','2')"