Micro Focus QTP (UFT) Forums
Unix commands - 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: Unix commands (/Thread-Unix-commands)



Unix commands - stevol - 06-30-2008

Hi,
from QTP I have launched a SSH Client where I use unix commands. Here I create a variable: how can I use this variable out of unix commands, as QTP variable?
ex:
Code:
...
finestra.Type "dimensione=`du file.log | cut -b -1`"
finestra.Type micReturn
...
If dimensione = "0" Then
   ....
Else
   ...
End If


Thanks


RE: Unix commands - Ankur - 07-01-2008

Are you able to record the commands from QTP. If no, what are the add-ins you are using.


RE: Unix commands - stevol - 07-01-2008

yes I am able to write commands and obtain expected results from QTP. My problem is that I define a variable with a certain value inside shell, but I would use this value also outside the shell, so that I can use the Reporter object with classic If conditions. Is it possible?

Thanks


RE: Unix commands - Ankur - 07-01-2008

that is what my point is how are you interacting with shell application...how are you passing inputs to it...the same way can't you extract output from it?


RE: Unix commands - stevol - 07-01-2008

mmhhh... i don't believe to can use the same way. I interact from QTP to SSH client defining objects and passing text strings + enter, in this way:

Code:
dim crt, conn, tree, butt, finestra
set crt  = Window("regexpwndtitle:= SecureCRT", "index:=0")
set conn = crt.Window("regexpwndtitle:=Connect", "index:=1")
set tree = conn.WinTreeView("regexpwndclass:=SysTreeView32")
set butt = conn.WinButton("regexpwndtitle:=&Connect")
      
SystemUtil.Run "C:\Programmi\SecureCRT\SecureCRT.EXE"
tree.Select "Sessions;BEA_BE;machinexyz"
butt.Click
crt.Activate
Set finestra = crt.WinObject("regexpwndclass:=AfxFrameOrView42")
wait(5)
      
finestra.Type "cd /path_log"
finestra.Type micReturn
finestra.Type "esist=`du file.log | cut -b -1`"
finestra.Type micReturn


i.e. QTP uses SSH client as ... ehm... a monkey worker :-)
Now the variable "esist" will be =0 or <>0 according to the existence of file.log, but only on this SSH client, not in the script... i can't use "esist" in if-statements... i would need something similar to getroproperty to capture the value of "esist" inside a QTP variable... as:
Code:
dim exist
exist=finestra.getroproperty(esist)
[I know it's impossible because object spy doesn't see the value of 'esist']

Is it possible in some other way or it can't be return in QTP from other applications? maybe i should do a ftp from machinexyz to my pc with SSH client, then create an object with Scripting.FileSystemObject...

sorry for post length and thanks