Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem withuploading files when windows is locked
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
hi all ,

i have an application in which i have upload files functionality. i automated it and it works well until windows is not locked.But if windows is locked and scripts run, QTP can not upload files and throws an error "object not found..."
not only upload dialog box but also for other dialog boxes QTP gets struck.

i goggled for the solution and i got following code snippets ,just to close a dialog box when windows is locked:

Code:
Public Const WM_COMMAND=273
Extern.Declare micLong, "PostMessage", "user32.dll", "PostMessageA", micHwnd, micLong, micLong, micLong
windowTitle = "message from browser " 'change it for different dialog box
buttonCode = 1 ' 1- OK, 2 Cancel in this dialog. It is "window id" property of the Button that you need to click - use Object Spy
Hwnd = Window("regexpwndtitle:="&windowTitle).GetRoProperty("hwnd")
lResult = extern.PostMessage(Hwnd, WM_COMMAND, buttonCode, 0)


this really helped me a lot But i got struck once again when it was a time to 'choose a file'/'type a file name' in "CHOOSE FILE TO UPLOAD" dialog box.

could any one explore his/her ideas on this issue?
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
you can use caffeine tool to prevent your system from locking.
startup the caffeine tool from qtp when you begin execution of scripts like this:
Code:
InvokeApplication "{path of caffeine in your PC} -startoff"
wait(2)
InvokeApplication "{path of caffeine in your PC} -appon"

and when ur execution complete stop caffeine
InvokeApplication "{path of caffeine in your PC} -appexit"
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Caze,
QTP can not perform operations when your system is locked. you should find out a way same as Satan suggested to prevent your system from locking.

Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
hi @ saket,
i took help of descriptive programing and its working even if my system is locked.
what satan suggested is also a good and esay idea.
thanks satan,saket.
hi @ satan,

will caffeine work if i schedule a task at night 1'clk when window is locked?
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
caffeine is a tool which will prevent you from locking.
but it is of no use once system is locked.
there is a work around that u can implement.
like start caffeine and leave your system unlocked.
use your scheduler to call qtp at any point later on.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem in Recording .net windows application sk.aravind 8 5,725 11-20-2009, 01:13 PM
Last Post: v_selvam
Rolleyes attachment when computer is locked Usman Muzaffar 0 1,703 02-25-2009, 01:34 PM
Last Post: Usman Muzaffar

Forum Jump:


Users browsing this thread: 1 Guest(s)