Jump to content

Not activating desired window


shiv
 Share

Recommended Posts

if $Subject And $Type = 'Reply' Then    
    
    $title = "RE:"&" " & $Subject & " - Message"&" "&"("&$Format&")"
ElseIf $Subject And $Type = 'Forward' Then
    $title = "FW:"&" " & $Subject & " - Message"&" "&"("&$Format&")"
ElseIf $Subject Then
    $title = $Subject & " - Message"&" "&"("&$Format&")"
            $iWindow = WinActivate($title,"")
            If $iWindow==0 Then
            $sRemark = "FAIL"
            
            Return $sRemark

in the above code

$iWindow = WinActivate($title,"")

is not able to activate the appropriate title.

    every time it just activate the title for statement mentioned below

ElseIf $Subject Then
    $title = $Subject & " - Message"&" "&"("&$Format&")"

because $Subject is passed in parameters every time however $Type is used only duirng reply of mail

     i have also tried the   

ElseIf Not $Type And $Subject Then

but it is also not working

    

     what i want is that is both the parametsrs are passed($Subject,$Type) the it should activate the title as

"RE:"&" " & $Subject & " - Message"&" "&"("&$Format&")"

 mentioned in the top of the code

     However if only $Subject is passed then it should activate the title

$title = $Subject & " - Message"&" "&"("&$Format&")"

Thanks

Edited by shiv
Link to comment
Share on other sites

You need to show us the function definition or we can't understand enough to give a sensible answer, and you haven't shown an EndIf.

Also, rather than

If $Subject

it would be more readable to me to have

If $Subject <> ''

but it possibly makes no difference.

In general using strings as way of setting different conditions is something I do not like to do, I prefer numbers like this

Const $SENDFORWARD = 1, $MAKEREPLY = 2


SomeFunc("an eample",$SENDFORWARD)
 
Func SomeFunc($Subject = '', $Reply = 0)
 
switch $Reply
 case 0
     some code
 case $SENDFORWARD
    some more code
case $MAKEREPLY
  blahblah
 endswitch
 
endfunc
 
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

HI martin,

I have clearly explained all the things above. Well Endif does not make any difference here but obvious it would be at the end.

Fn definition is like this

MailReceived(  $Type, $Subject,$Format)

This topics is only regarding the window title

1. if simple mail is opened by double clicking then it would have a window title.

2. if we reply to that mail(M1).

3. mail(M1) received and then open it in separate window by double clicking on it then it would have different window title which i have mentioned above

if $Subject And $Type = 'Reply' Then    
    
    $title = "RE:"&" " & $Subject & " - Message"&" "&"("&$Format&")"
ElseIf $Subject And $Type = 'Forward' Then
    $title = "FW:"&" " & $Subject & " - Message"&" "&"("&$Format&")"
ElseIf $Subject Then
    $title = $Subject & " - Message"&" "&"("&$Format&")"
            $iWindow = WinActivate($title,"")
            If $iWindow==0 Then
            $sRemark = "FAIL"
            
            Return $sRemark

Further please go through the above mentioned

Link to comment
Share on other sites

Your version of "clearly explained" is not the same as mine. :)

You could help yourself by adding something to your code to work out what is going wrong. For example

ConsoleWrite("$Subject is " & ($ubject = true) & @CRLF)
ConsoleWrite("The statement $Type = 'Reply' is " & ($Type = 'Reply') & @CRLF)
ConsoleWrite("The statement $Type = 'Forward' is " & ($Type = 'Forward') & @CRLF)
 
 

 

From your first post I thought the problem you were explaining was the apparrent failure of your If, Then Else logic.

EndIf does make a difference because if you have missed it out I do not know where it has been missed out.

You hadn't shown enough fo rme to be able to give a usefull reply and, unfortunately, your second post added nothing to my understanding. I still don't know where the EndIf should be. If it is after the code you have shown then WinActivate may never get called.

Maybe someone else can assist you.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...