Advanced Object Building (not looking for a miracle)

A while ago, I thought it would be neat if you could have an object that showed the title of the current open window, and also had the resizing and close buttons on it. I think I asked in the forums, and it was suggested it couldn't be done, so I emailed support. The gist of the reply was as follows:

"...this is not supported by DesktopX natively, but the ability to create and utilize COM objects (using Set obj = CreateObject(...)) gives you a LOT of flexibility.

Closing, Resizing and Maximizing a window may be possible, but Rolling up and down windows is not something built in to Windows.

You will probably want to search for source code to applications like spy++. This allows you to get a lot of information about applications that are currently running. Using this information, it is possible to interact with those applications."

On the plus side, this gave me hope that it could be done, but on the down side, I have NO idea how to go about something like that, and so the idea fell by the wayside - it wasn't that important to me.

Recently however, the idea struck me to create a windows skin with SkinStudio that allows for maximum screen real estate - including NO titlebar. Instead, I would create a desktopX object that would autohide along the top edge of the screen, and would show the window title as well as the control buttons. I of course remembered that email from long aog, and so, with a practical goal in mind, thought I'd ask for advice, pointers, help etc, here on the forums. I'm no master coder by any means, but if anyone could help me find the 'spy++' source code or similar, I'm generally quite good atpicking things up, and would be happy to play with it on my own.

Thanks.
10,462 views 20 replies
Reply #1 Top
You could use ObjectBar for this.
It allows you to display the title of the active window as well as sending Close/Minimize/Restore commands to the active window. And it also got builtin autohide function, so all you need to do is add the text element to contain the title text, the buttons and the skin to go with it.

I think you can even embed DesktopX objects into ObjectBar if you should require that.
Reply #3 Top
While I appreciate that you are attempting to help us DesktopX users I don't think it was appropriate for you to be pasting the response of a techsupport ticket here word for word. Being a ExSupport person those responses are for you and you alone. You could summarize or something of that nature but it is rude to paste it directly to be dissected by the masses at large.

Think of it like you were having some instant message conversation then posted it on some forums somewhere. The other person would be pretty ticked off I would think.

I am not trying to be rude but I often think that many people see support as "Them" and they are really just users like us. It's rude to treat them as anything else. Keep in ming I am not flaming here only pointing out my thoughts on the matter.
Reply #4 Top
You are of course, quite right. I ought to have paraphrased the mail. I meant no disrespect to the support team - I was merely rushing to get my message posted and didn't really think. I apologise.
Reply #5 Top
Another one to look at may be specifically the AutoITX Com object but, it won't expose the GDI either.

If you're doing this solely for yourself it would be possible to script external commands using the extended Auto3Lib that exposes the GDI. Then just call the specific scripts from your objects within DesktopX.
Reply #6 Top
Unfortunately the only link I could find for an 'Auto3Lib' was down. Do you have the necessary files or know where I can get them?

EDIT: I've managed to create an .aut script that displays the active window title. How exacly do I go about calling that in DesktopX?

Thanks.
Reply #8 Top
You're a star sir, a star.
Reply #9 Top
A further question as I toil along this arduous path (which probably shouldn't be this hard for me ):

Is there a way to have it so an object doesn't steal focus, either through its options (I've looked, but maybe overlooked something) or through scripting?

Thanks.
Reply #10 Top
Still wondering about exempting objects from focus, but also,

can't seem to find an autoITX COM object. Can you offer any more advice on that (google proved most unhelpful)?
I've created some objects that simply open the script file when I click on them, but for some other objects I'm going to need to embed autoit scripts in objects (which I assume is what the COM object SirSmiley mentioned does.

If anyone needs more info, please say and I'll happily edit my post.
Reply #11 Top
The com object comes with the full install of AutoIt. There should be a subfolder called AutoItX that contains the object, help file and some sample scripts.

AutoIt Script Homepage
Reply #12 Top
Got it. Right, now to look through all this and see if I can get a bit further

Cheers SirSmiley
Reply #13 Top
You're a star sir, a star.
Also a big smiley face.  Nice for him. 
Reply #14 Top
Okay, I give.

I get DesktopX scripting, and I get how to make the AutoItX scripts. I can't figure out the merging of the two. According to the AutoItX help, I was supposed to do this:

To register the COM interface:

1. Open a command prompt

2. Change directory (using CD) to the directory that contains AutoItX3.dll

3. Type regsvr32.exe AutoItX3.dll and press enter

So I did. Then, just to test how it worked, I copied line for line one of the VBScripts in the examples, and pasted it into a desktopx object script. I got an error. DesktopX uses, or can use, VBScript, right?

Obviously I'm doing something wrong here, some intermediate step, but I'm damned if I can figure it out.

I officially suck. But at least I'll only need to learn this once.
Reply #15 Top
Is your code like this?
Code: vbscript
  1. Set oAutoIt = CreateObject("AutoItX3.Control")
Reply #16 Top
Yep, that bit seems to work, but beyond that is where I get lost. I thought I could just use:

oAutoIt.*** where the asterisks are my AutoIt code, but I just get errors.
Reply #17 Top
Are you sure you registered it and didn't unregister it? Also, not all of the AutoIt capabilities are exposed in the com object.
Reply #18 Top
I think I'm getting there now. I re-registered, and the only error I'm getting now is with a line of my code 'expected end of statement'

Set oAutoIt = CreateObject("AutoItX3.Control")

Sub Object_OnScriptEnter
object.SetTimer 1,1
End Sub

Sub Object_OnTimer1
title = oAutoIt.WinGetTitle "", ""
object.Text=title
object.SetTimer 1,1
End Sub

There's my code. The error comes at line 8 - 'title = ...', and as I said, it's 'Expected end of statement'. Admittedly, it's been a good few months since I did any desktopx scripting, so this is probably a stupid error.
Reply #19 Top
SOLVED!

Here's my final code, which displays current window title and updates frequently:

Set oAutoIt = CreateObject("AutoItX3.Control")

Sub Object_OnScriptEnter
object.SetTimer 1,1
End Sub

Sub Object_OnTimer1
title = oAutoIt.WinGetTitle ("","")
object.Text=title
object.SetTimer 1,1
End Sub

SirSmiley, I am indebted to you for your help with this, as it is a problem that's been plaguing me for MONTHS. Thank you.

SOLVED!
Reply #20 Top
No problem.

I've taken a break from Dx scripting and been exploring AutoIt over the last few weeks so, it was fresh in my mind.