Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

VBScript: AppActivate / Restore Window not working

Hi All,

I'm trying to restore a window that has been minimised but I can't get the VBScript working?

This should work:

sub restore

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.AppActivate "Untitled - Notepad"

success = WshShell.appactivate("Untitled - Notepad")

if success then WshShell.sendkeys "% r"

end sub

Any ideas, to where I've gone wrong?

Tags (1)
7 Replies

Re: VBScript: AppActivate / Restore Window not working

Jammy,

Try this,


Sub restore

Set WshShell = CreateObject("WScript.Shell")   

WshShell.AppActivate "Untitled - Notepad" 

success = WshShell.appactivate("Untitled - Notepad") 

if success then WshShell.sendkeys "% r"

End Sub

Not applicable

Re: VBScript: AppActivate / Restore Window not working

Tried but unfortunately it still doesn't restore the minimised program?

vikkyv
Contributor II

Re: VBScript: AppActivate / Restore Window not working

rem **Can you try this**

set c=ActiveDocument.GetSheetObject("YourObjectID")

if c.IsMaximized then

    c.Restore

else

    c.Maximize

end if

Not applicable

Re: VBScript: AppActivate / Restore Window not working

This didn't work either

vikkyv
Contributor II

Re: VBScript: AppActivate / Restore Window not working

Can you show a screenshot of what kind of object you want to minimize ?

If trying to restore objects when navigating from one sheet to other.....This would make all minimized object to maximize in active sheet object, if any...

Sub maxi

set s = ActiveDocument.ActiveSheet.SheetObjects(0).GetSheet

for i=0 to s.NoOfSheetObjects-1

    s.SheetObjects(i).restore

next

end sub

Not applicable

Re: VBScript: AppActivate / Restore Window not working

After a macro is run, for some reason Qlikview gets confused & brings the last active window to the front.

For example... I open a QV file from explorer -> run the macro in QV -> explorer is brought to the font.

If explorer is minimised, this doesn't happen.  So I need a script which restores QV to the front.

I have this working:

Sub open

dim objSHL

set objSHL = createobject("wscript.shell")

objSHL.AppActivate "Notepad"

objSHL.sendkeys "(% )(R)"

End Sub

So this will restore Notepad to the front.

But now the next question..... how to restore the current QV project to the front?

I've substituted "Notepad" with... "QliKView", "QlikView x64........ " all combinations but it doesn't restore QV to the front!?

Any more ideas, as it's driving me crazy?

Re: VBScript: AppActivate / Restore Window not working

In my experience it should be last way to solve a task with activating/restoring windows and sending shortcuts per any script - it won't never run really stable. Therefore what is your real aim? Maybe there are other ways to get your wanted results.

- Marcus

Community Browser