Micro Focus QTP (UFT) Forums
Code issue - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Code issue (/Thread-Code-issue)

Pages: 1 2 3


Code issue - 1981.madhu@gmail.com - 10-27-2009

Hi ,

I have excel sheet name as Book4.xls,in that 1 sheet having the Coulmn names as Script_Path,Repository_Path,Flag.

Script_path is nothing that iam giving the path of the my .vbs file and Repositopry _path is my repository path(.tsr file) and Flag value either "y " or "n".if flag="y".


Code:
datatable.AddSheet("newsheet")
datatable.ImportSheet "c:\tdf\spreadsheet.xls","sheet1","newsheet"
n=datatable.GetSheet("newsheet").getrowcount
For i = 1 to n
   datatable.SetCurrentRow(i)
   flag=datatable.value("Flag","newsheet")
   If flag = "y" Then
         scriptpath=datatable.Value("Script_Path","newsheet")
         objpath=datatable.Value("Repository_Path","newsheet")
      

       executefile scriptpath
      

   End If
Next

***//Pls help me,and correct the code
wen ever executing this script getting eroor as " expecting "if"

and as well as well how to add objpath to specific scriptth path ?


RE: Code issue - Saket - 10-28-2009

I am not able to get your second question -"how to add objpath to specific scriptth path ?" exactly what do you want to do?
I dont see any issue with your code that you have pasted. I tried to execute that and not found any error as mentioned.
Can you check if there is any IF statement before or after this piece of code and not properly handled?


RE: Code issue - 1981.madhu@gmail.com - 10-28-2009

saket ,create a excel sheet and create a columns as i mentioned in the code and give the paths and execute the scenario...it wont working thats my problem.

coming to second point --its resolved Repositories.add Objpath.

Pls execute one scnario as i mentioned in the earlier..its not working ..pls suggest


RE: Code issue - Saket - 10-28-2009

what is the error that you are getting and at which line?


RE: Code issue - 1981.madhu@gmail.com - 10-28-2009

iam not getting error ,wen ever i execute it has to execute that .vbs file .which i mentioned in the excel


RE: Code issue - Saket - 10-28-2009

unfortunately I dont get any error at my side, I am able to execute a vbs with the code.
Can you try running the vbs file? or run only the ExecuteFile statement.

I doubt there may be some issue with your vbs file.


RE: Code issue - 1981.madhu@gmail.com - 10-28-2009

My vbs file code is :

sysstemutil.run "Flight app path in my system"

Code:
Dialog("lOgin").winedit("Agent Name").SET "MADHU"
Dialog("lOgin").winedit("Password").SET "MERCUTY"

dialog("Login").Winbutton("ok).click
saved this in my local machine as .vbs file.That path i given at execl sheet and recoded obects .tsr file path stored in the some path that path al;so i given in excel .

will u place ur code and steps pls .did u changed anything in the code?


RE: Code issue - Saket - 10-28-2009

why do you need to put those statements in a vbs file?
You will not able to run your vbs file with these code in a vbs file.

You should use these statements in the QTP script itself.


RE: Code issue - 1981.madhu@gmail.com - 10-28-2009

Did this code is not execute?pls paste ur vbs file .that i would execute .

Iam running one action.
pls attache ur vbs file and tsr files which are used in this scenario.pls saket


RE: Code issue - Saket - 10-28-2009

i did not get you, which vbs file you want me to paste here?