Messages - BigVent [ switch to compact view ]

Pages: [1] 2 3 4 5 6 ... 8next
1
Post New Requests Here / Re: IDEA: AutoMaximize Windows
« on: April 24, 2015, 09:27 AM »
Give this a shot & see what it does for you.


Code: Autohotkey [Select]
  1. ;http://www.autohotkey.com/board/topic/19672-detect-when-a-new-window-is-opened/
  2. ;DLLCall / Shell / MsgBox = SKAN
  3.  
  4. ;-------------------------------------------------------------------
  5. ;--Program monitors newly opened windows & maximizes accordingly--
  6. ;-------------------------------------------------------------------
  7.  
  8. SetWorkingDir %A_ScriptDir%
  9. onexit, exitsub
  10.  
  11. Gui +LastFound
  12. hWnd := WinExist()
  13.  
  14. DllCall( "RegisterShellHookWindow", UInt,hWnd )
  15. MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
  16. OnMessage( MsgNum, "ShellMessage" )
  17. Return
  18.  
  19. ShellMessage( wParam,lParam )
  20. {
  21.   Local k
  22.   If ( wParam = 1 ) ;  HSHELL_WINDOWCREATED := 1
  23.   {
  24.        NewID := lParam
  25.        SetTimer, MsgBox, -1
  26.   }
  27. }
  28.  
  29.          WinGetTitle, Title, ahk_id %NewID%
  30.          WinGetClass, Class, ahk_id %NewID%
  31.          WinWait, ahk_id %NewID%
  32.                                
  33.         ;add items you do NOT want maximized here... e.g. Properties Window (Alt+Enter), WinRar, etc.
  34.         ;*Note: WinTitles need to be case sensitive
  35.         if InStr(Title, "Properties") || InStr(Title, "WinRar")
  36.                 return
  37.         else
  38.                 minmax_func()
  39. Return
  40.  
  41. ralt & Esc::    ;right Alt key & Esc
  42. exitsub:
  43. {
  44.     critical
  45.         Exitapp
  46. }
  47.  
  48. ;=================
  49. ;==Function(s)====
  50. ;=================
  51. minmax_func()
  52. {
  53.         global NewID, minmax
  54.         WinGet, minmax, minmax, ahk_id %NewID%
  55.  
  56.    if (minmax=0)
  57.    {
  58.       WinMaximize, ahk_id %NewID%
  59.           ;use PostMessage for stubborn windows
  60.           ;PostMessage, 0x112, 0xF030,,, NewID  ; 0x112 = WM_SYSCOMMAND, 0xF030 = SC_MAXIMIZE
  61.    }
  62.    else
  63.         if (minmax=-1)
  64.         {
  65.                 WinRestore, ahk_id %NewID%
  66.         }
  67. }

2
My apologies for not placing a link sooner.

Very old topic (I know) but just in case a solution was never found:

https://www.donationcoder.com/forum/index.php?topic=36620.0

3
Here's a very quick example of what you needed.

Notes:
  • Timer is set to fire after 45 minutes of idle time (adjust as needed)
  • Should the program then exit after it fires? (I'm not sure how often you needed notices so I'll leave that up to you)
  • Easy email send via COM - adjust your email & credentials


Enjoy!

Code: Autohotkey [Select]
  1.  
  2. time := 2700000 ;//45 minutes
  3.  
  4. SetTimer, check, 300000 ;//check once every 5 min
  5. return
  6.  
  7. check:
  8.         if(A_TimeIdle >= time)
  9.         {
  10.                 email()
  11.                 SetTimer, check, off
  12.         }
  13. return
  14.  
  15. ;//function email
  16. email()
  17. {
  18.         pmsg                    := ComObjCreate("CDO.Message")
  19.         pmsg.From               := "[email protected]"
  20.         pmsg.To                 := "[email protected]"
  21.         pmsg.BCC                := ""   ; Blind Carbon Copy, Invisable for all, same syntax as CC
  22.         pmsg.CC                 := ""
  23.         pmsg.Subject    := "PC in question is idle"
  24.  
  25.         ;You can use either Text or HTML body like
  26.         pmsg.TextBody   := A_Username " 's PC is idle."
  27.         ;OR
  28.         ;pmsg.HtmlBody := "<html><head><title>Hello</title></head><body><h2>Hello</h2><p>Testing!</p></body></html>"
  29.  
  30.         ;var := A_ScriptDir
  31.         ;msgbox % var
  32.         ;"%SPVvar%"|"%VPNvar%"
  33.         ;SPVvar := A_ScriptDir "\blah.txt"
  34.         ;VPNvar := A_ScriptDir "\blah1.txt"
  35.  
  36.         sAttach                 = ;%SPVvar%|%VPNvar%
  37.  
  38.  
  39.                 ; can add multiple attachments, the delimiter is |
  40.  
  41.         fields := Object()
  42.         fields.smtpserver   := "smtp.gmail.com" ; specify your SMTP server
  43.         fields.smtpserverport     := 465 ; 25
  44.         fields.smtpusessl      := True ; False
  45.         fields.sendusing     := 2   ; cdoSendUsingPort
  46.         fields.smtpauthenticate     := 1   ; cdoBasic
  47.         fields.sendusername := "[email protected]"
  48.         fields.sendpassword := "password12345"
  49.         fields.smtpconnectiontimeout := 60
  50.         schema := "http://schemas.microsoft.com/cdo/configuration/"
  51.  
  52.         pfld :=   pmsg.Configuration.Fields
  53.  
  54.         For field,value in fields
  55.                 pfld.Item(schema . field) := value
  56.         pfld.Update()
  57.  
  58.         Loop, Parse, sAttach, |, %A_Space%%A_Tab%
  59.           pmsg.AddAttachment(A_LoopField)
  60.          
  61.         pmsg.Send()
  62.         return
  63. }
  64.  
  65. esc::
  66.         critical
  67.         exitapp
  68. return

4
Can you provide a test vcf to use?  It'd be helpful to see one in action (change the names ofc)

5
N.A.N.Y. 2014 / Re: N.A.N.Y 2014 Submission: FTP File Uploader
« on: January 21, 2014, 10:26 AM »
Here's an updated exe. (above)

"Though I liked the concept of putting the files on to a file and uploading them, however it would had been better if there was an option to mention the FTP server’s address, username and password so the repeated task of typing in the details could be avoided." - Shine

Implemented & added the suggestion.  I agree that it would help the user especially if you're only using the same ftp.



Enjoy!

Pages: [1] 2 3 4 5 6 ... 8next
Go to full version