Sign in to follow this  
Followers 0
Shyke

WinGetTitle Problems...

17 posts in this topic

Alright, this is my problem. I have:

$target = IniRead(@TempDir & "\db.zip", "PartyKiller", $booster, "hemmelshlobbin")

WinGetTitle($target)

Why does the wingettitle return as 0?

Share this post


Link to post
Share on other sites



LOL... looking at my crystal ball here... says check your ini file to make sure there is a value there, check your variable to make sure you have it going to the right key, use MsgBox(0, 'Debug', WinGetTitle($target)) to debug it.

So:

MsgBox(0, 'Debug Ini', $Target)
MsgBox(0, 'Debug Title', WinGetTitle($target))

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I get ventrilo, just as I thought I would... I am not that dumb.

Anyways when I do that I get:

ventrilo

0

Edited by Shyke

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Did you try using Opt('WinTitleMatchMode', 4) ? I'm not calling you dumb, but you post a question with an ini file related, and we don't have the ini file to re-produce the issue... that was the comment... 2 lines of code... no way to reproduce... :lmao:

Edit:

So basically, off your code, I have to say that either your not using the correct WinTitleMatchMode or the window doesn't exist is why your getting a '0'.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I will try with the window up then... hold on.

Window was up and still a 0.

I am using windows match 4...

Edited by Shyke

Share this post


Link to post
Share on other sites

Opt('WinTitleMatchMode', 2) Did you that one too?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I just did.

Still 0.

Share this post


Link to post
Share on other sites

lol... ok... did you try using the classname of the window? (Would suck if it were a browswer window) Are you spelling the name of the window correctly? I mean... It just doesn't return a '0' unless the window doesn't exist. Try using AutoInfo Tool on it, and replace $title with what AutoInfo gives for a title and see what you get.

You could try this:

Opt('WinTitleMatchMode', 4)
MsgBox(0, '', WinGetTitle('classname=IMWindowClass')); my msn messenger window... only works with titlematchmode, 4 with classname=

Or

Opt('WinTitleMatchMode', 4)
$Handle = WinGetHandle('classname=IMWindowClass')
MsgBox(0, '', WinGetTitle($Handle))

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Still "0".

In the ini I have:

[PartyKiller]amount=4

1=ventrilo

2=teamspeak

3=mirc

4=trillian

Run this:

$booster = 1

$amount = IniRead("db.zip", "PartyKiller", "amount", "error")

$target = IniRead("db.zip", "PartyKiller", $booster, "hemmelshlobbin")

$WindowPartTitle = WinGetTitle($target)

MsgBox(0, "Title", $WindowPartTitle)

Have fun, lol... you get a 0.

Share this post


Link to post
Share on other sites

Well, I'm definately going to get a '0' because I don't have a window called Ventrilo. But if I rename my Notepad window to Ventrilo it gives me 'Ventrilo - Notepad' as my window title.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Um.... I just noticed you were trying to read a .zip file and not an .ini file... that's a good reason why you get a '0'.

$booster = 1
$amount = IniRead("db.zip", "PartyKiller", "amount", "error")
$target = IniRead("db.zip", "PartyKiller", $booster, "hemmelshlobbin")
MsgBox(0, 'Debug Ini', $target)
$WindowPartTitle = WinGetTitle($target)
MsgBox(0, "Title", $WindowPartTitle)

If you run that, your Debug Ini MsgBox will probably say 'hemmelshlobbin'


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Make a standard GUI called "Ventrilo"... then try. It should still give you a 0.

Share this post


Link to post
Share on other sites

Still '0'.

Booster is only there to scroll through the amount of banned 3rd party programs.

There seems to be a problem between $target and Wingettitle. If I put "WinGetTitle("Ventrilo") then it works but as $target it equals 0 for some reason by if I debug $target I get Ventrilo...

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

So your saying with the filename being 'db.zip' and not 'db.ini' you are still able to get a value from it? That's weird in itself.

Edit:

I changed the extension myself, and sure enough I was able to read it as .zip. Guess you learn something new everday.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yep, you can still get values from it, I learned this a LONG time ago. It doesn't matter what the name is.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Works for me when I capitalize the 'V' in the ini/zip file.

Edit:

This worked too with it being lowercase in the ini/zip

Opt('WinTitleMatchMode', 4)
$booster = 1
$target = IniRead("db.zip", "PartyKiller", $booster, "hemmelshlobbin")
$WindowPartTitle = StringLower(WinGetTitle(($target)))
MsgBox(0, "Title", $target)
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yep, your right. I guess grammer does matter.

Thank-you you guys for your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0