Jump to content
Sign in to follow this  
SmOke_N

Beta & WinGetTitle?

Recommended Posts

Case $msg = $Button_7
         Opt("WintTitleMatchMode", 2);;;;;;;;;; 1, 2, 3, or 4(with using even "last") won't work
         $title = WinGetTitle("FirstPossibleTitle" Or "SecondPossibleTitle")
         If $title = "0" Or $title = "1 - 34" Then;;;;;;;;; Put this If statement out of frustration
            MsgBox(48, "Problem Retrieving Title", "This title will have to be entered manually.", 10)
            GUICtrlDelete($Combo_6)
            $Combo_6 = GUICtrlCreateCombo("", 20, 130, 300, 21)
         Else
            GUICtrlDelete($Combo_6)
            $Combo_6 = GUICtrlCreateCombo($title, 20, 130, 300, 21)
         EndIf

Um, this used to work till I installed Beta .38? I can't imagine the beta really causing the error of consistantly getting a "0" or "1 - 34" as a tilte name. Considering that neither of those are "FirstPossibleTitle" or "SecondPossilbeTitle", I'm getting frustrated :(

I've Compiled with regular Autoit then ran w/ beta run and compiled with beta compile, still no help.

Any suggestions?


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.

Share this post


Link to post
Share on other sites

Case $msg = $Button_7
         Opt("WintTitleMatchMode", 2);;;;;;;;;; 1, 2, 3, or 4(with using even "last") won't work
         $title = WinGetTitle("FirstPossibleTitle" Or "SecondPossibleTitle")
         If $title = "0" Or $title = "1 - 34" Then;;;;;;;;; Put this If statement out of frustration
            MsgBox(48, "Problem Retrieving Title", "This title will have to be entered manually.", 10)
            GUICtrlDelete($Combo_6)
            $Combo_6 = GUICtrlCreateCombo("", 20, 130, 300, 21)
         Else
            GUICtrlDelete($Combo_6)
            $Combo_6 = GUICtrlCreateCombo($title, 20, 130, 300, 21)
         EndIf

Um, this used to work till I installed Beta .38?  I can't imagine the beta really causing the error of consistantly getting a "0" or "1 - 34" as a tilte name.  Considering that neither of those are "FirstPossibleTitle" or "SecondPossilbeTitle", I'm getting frustrated  :(

I've Compiled with regular Autoit then ran w/ beta run and compiled with beta compile, still no help.

Any suggestions?

<{POST_SNAPBACK}>

Don't see how that would ever work

From help file

WinGetTitle ( "title" [, "text"])

Parameters

title The title of the window to read.

text [optional] The text of the window to read.

Return Value

Returns a string containing the complete window title. Returns numeric 1 if no title match.

Remarks

WinGetTitle("") returns the active window's title. WinGetTitle works on both minimized and hidden windows. If multiple windows match the criteria, the most recently active window is used.

Therefore one of the following would be more apt to work

Run("Notepad")
Sleep ( 1000 )
$title = WinGetTitle("Untitled - ")
$title2 = WinGetTitle("")

Either one of the two WinGetTitle calls should get the full title


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Are you saying that you don't see how "Or" would work? You've recalled the "help file" but it supports what I've done.

EDIT: I Would then have to have a statement like: $Combo_6 = GUICtrlCreateCombo($title Or $title2, 20, 130, 300, 21)? or an If statement is what your suggesting? Sorry, but this is my first language I've tried to learn.

Edited by ronsrules

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.

Share this post


Link to post
Share on other sites

I know autoit allows or statements

Have to be careful how they are used

for example

Opt("WinTitleMatchMode", 2)
Run("Notepad")
Sleep ( 1000 )
ConsoleWrite(WinGetTitle("Untitled - " or "Notepad") & @LF)
ConsoleWrite(WinGetTitle("Untitled - ") & @LF)
ConsoleWrite(WinGetTitle("Notepad") & @LF)

Produces on my machine

>Running: (3.1.1.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Gary\My Documents\test5.au3" 

ISLALERT_WINDOWNAME_{DA5EA0DE-0190-4755-9ABE-C6DBF5A1008B}

Untitled - Notepad

Untitled - Notepad

>AutoIT3.exe ended.

>Exit code: 0    Time: 2.074

Also in beta

>Running: (3.1.1.41):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Documents and Settings\Gary\My Documents\test5.au3" 

ISLALERT_WINDOWNAME_{DA5EA0DE-0190-4755-9ABE-C6DBF5A1008B}

Untitled - Notepad

Untitled - Notepad

>AutoIT3.exe ended.

>Exit code: 0    Time: 2.601

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Case $msg = $Button_7
         $title = WinGetTitle("FirstPossibleTitle")
         $title1 = WinGetTitle("SecondPossibleTitle")
         $title2 = WinGetTitle("ThirdPossibleTitle")
         GUICtrlDelete($Combo_6)
         Sleep(100)
         If $title = WinGetTitle("FirstPossibleTitle") Then
         $Combo_6 = GUICtrlCreateCombo($title, 20, 130, 300, 21); New combo box w/ title in it
         Elseif $title1 = WinGetTitle("SecondPossibleTitle") Then
         $Combo_6 = GUICtrlCreateCombo($title1, 20, 130, 300, 21); New combo box w/ title in it
         ElseIf $title2 = WinGetTitle("ThirdPossibleTitle") Then
         $Combo_6 = GUICtrlCreateCombo($title2, 20, 130, 300, 21); New combo box w/ title in it
         Else
            MsgBox(48, "Problem Retrieving Title", "This title will have to be entered manually.", 10)
            $Combo_6 = GUICtrlCreateCombo("", 20, 130, 300, 21); New combo box w/ title in it
         EndIf

Better? This works at least. :(

Edited by ronsrules

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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...