Jump to content

WinGetTitle Problems...


Recommended Posts

  • Moderators

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))

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.

Link to post
Share on other sites
  • Moderators

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

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.

Link to post
Share on other sites
  • Moderators

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

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.

Link to post
Share on other sites
  • Moderators

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))

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.

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.

Link to post
Share on other sites
  • Moderators

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.

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.

Link to post
Share on other sites
  • Moderators

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'

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.

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...

Link to post
Share on other sites
  • Moderators

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

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.

Link to post
Share on other sites
  • Moderators

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

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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...