Jump to content

[Solved] Some Code Help


IanN1990
 Share

Recommended Posts

Heya,

I am a little confused at why this is not working.

for "- Chat", if someone messages me on steam it restores the steam-chat window "as i have no-taskbar"

but for MSN and skype, though the flash disappears it doesn't restore the chat windows. Would anyone have any idea why?

Opt('WinTitleMatchMode', 2 )
while 1
    If  _Flash("- Chat") <> 0 Then
        WinSetState("- Chat","",@SW_RESTORE)
ElseIf _Flash("[Class:TConversationForm]") <> 0 Then
WinSetState("[TConversationForm]","",@SW_RESTORE)
elseif _Flash("[Class:IMWindowClass]") <> 0 Then
WinSetState("[Class:IMWindowClass]","",@SW_RESTORE)

    EndIf
    Sleep(100)
WEnd
Func _Flash($win)
    If WinActive($win) Then Return 0
    $tFLASHWINFO = DllStructCreate("uint;hwnd;dword;uint;dword")
    DllStructSetData($tFLASHWINFO, 1, 20)
    DllStructSetData($tFLASHWINFO, 2, WinGetHandle($win))
    $a = DllCall("user32.dll", "int", "FlashWindowEx", "ptr", DllStructGetPtr($tFLASHWINFO))
    Return $a[0]
EndFunc

I use

Opt('WinTitleMatchMode', 2 )
WinFlash("[Class:IMWindowClass]","", 2, 1)
WinFlash("[Class:TConversationForm]","", 2, 1)
WinFlash("- Chat","", 2, 1)

for making them flash for testing

Edited by IanN1990
Link to comment
Share on other sites

Why not try WinActivate?

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

In addition to what martin said FlashWindowEx is already included in WinAPI.au3 >> _WinAPI_FlashWindowEx.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

@Martin i changed the code to include WinActivate but it has the same effect. the _Flash detects the flash is happened, the if_flash runs because msn and skype loses their "flash" but they dont open. Whereas steam does, so the code does work but its just not working for msn or skype for some reason

Opt('WinTitleMatchMode', 2 )
;Run Loop
while 1
  Sleep(100)

;Check if steam is flashing
If  _Flash("- Chat") &lt;&gt; 0 Then
;Open steam chat window
WinSetState("- Chat","",@SW_RESTORE)

;Check if skype is flashing
ElseIf _Flash("[Class:TConversationForm]") &lt;&gt; 0 Then
;Open Skype chat window
WinActivate("[Class:TConversationForm]")

;Check if msn is flashing
elseif _Flash("[Class:IMWindowClass]") &lt;&gt; 0 Then
;Open msn chat window
WinActivate("[Class:IMWindowClass]")
EndIf
WEnd

;Detects if flashing
Func _Flash($win)
    If WinActive($win) Then Return 0
    $tFLASHWINFO = DllStructCreate("uint;hwnd;dword;uint;dword")
    DllStructSetData($tFLASHWINFO, 1, 20)
    DllStructSetData($tFLASHWINFO, 2, WinGetHandle($win))
    $a = DllCall("user32.dll", "int", "FlashWindowEx", "ptr", DllStructGetPtr($tFLASHWINFO))
    Return $a[0]
EndFunc

@Guinness i looked at the help file for that API, and from what i can gather its used to flash a window in a non-active way? I am not too sure how i would use this to check if a window is flashing and then show that program.

Edited by IanN1990
Link to comment
Share on other sites

What I meant was you're calling the API incorrectly and should opt for using _WinAPI_FlashWindowEx >>

Func _Flash($hWnd)
    If WinActive($hWnd) Then
        Return 0
    EndIf
    Return _WinAPI_FlashWindowEx($hWnd)
EndFunc   ;==>_Flash

MSDN Ref: FlashWindowEx

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Yea i really dont know lol, spent the last 50mins going though ur code, my code and the help fine with little success :D

*Edit Was the original Post i found that started me on this code

I cant understand why it would work for steam, and not for msn or skype

Edited by IanN1990
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...