Code Viewer

./timer.js File Size: 5.80 KB

  1. /*
  2. * -----
  3. * Screenshot Sender - timer.js
  4. * -----
  5. * Handles all timer functions for Screenshot Sender
  6. * -----
  7. */
  8.  
  9. var sWindow = '';
  10.  
  11. function OnEvent_Timer(sTimerId) {
  12.         _debug.getfuncname(arguments);
  13.         switch (sTimerId.toLowerCase()) {
  14.                 case 'countdown':
  15.                         if (TimerValue !== 0) {
  16.                                 objWindows['Countdown'].SetControlText('lblTimer', (TimerValue < 10 ? '0' : '') + TimerValue)
  17.                                 --TimerValue;
  18.                                 MsgPlus.AddTimer(sTimerId, 1000);
  19.                         } else if (TimerValue === 0) {
  20.                                 _win32.ShowWindow(objWindows['Countdown'].Handle, _win32._const._SW_HIDE);
  21.                                 var o = objCWindows[objWindows['Countdown'].Handle];
  22.                                 CommandToFunction(o.ChatWnd, o.SaveImage, o.Command);
  23.                                 CloseWindow('Countdown');
  24.                                 IsTimerActive = false;
  25.                         }
  26.                         break;
  27.                 case 'window':
  28.                         sWindow = 'WindowSelect';
  29.                 case 'pcc' :
  30.                         if (sWindow === 'WindowSelect' && new_hWnd !== _win32.GetForegroundWindow()) {
  31.                                 MsgPlus.AddTimer('window', 200);
  32.                                 return;
  33.                         }
  34.                         if (sWindow === '') sWindow = 'PointClickCapture';
  35.                         var lWindowRect = Interop.Allocate(16);
  36.                         var hWnd = _win32.GetForegroundWindow();
  37.                         _win32.GetWindowRect(hWnd, lWindowRect);
  38.                        
  39.                         var objCWindow = objCWindows[objWindows[sWindow].Handle];
  40.                         var oGdip = new Gdip(objCWindow.SaveImage);
  41.                         oGdip.Initialize();
  42.                         if (oGdip.Initialized == true) {
  43.                                 oGdip.SaveImage(oGdip.CaptureWindow(hWnd, lWindowRect, false, false, true), SessionImages.CreateTempImage());
  44.                                 if (oGdip.SaveSuccessful == true /*[Ok]*/) {
  45.                                         if (objCWindow.SaveImage == false) {
  46.                                                 if (objPreferences['cPreviews'] == true) {
  47.                                                         Preview(objCWindow.ChatWnd, oGdip.ImageLocation);
  48.                                                 }
  49.                                                 else {
  50.                                                         try {
  51.                                                                 if (objCWindow.ChatWnd.Contacts.Count === 1) oChatWnd_SendFile(objCWindow.ChatWnd, oGdip.ImageLocation);
  52.                                                                 else ContactSelector(objCWindow.ChatWnd.Contacts);
  53.                                                         } catch (e) {
  54.                                                                 var WndContactSelector = ContactSelector(Messenger.MyContacts);
  55.                                                                 objChatWnds[WndContactSelector.Handle] = {};
  56.                                                                 objChatWnds[WndContactSelector.Handle].Image = oGdip.ImageLocation;
  57.                                                         }
  58.                                                 }
  59.                                         } else {
  60.                                                 if (objPreferences['cPreviews'] == true) {
  61.                                                         Preview(objCWindow.ChatWnd, oGdip.ImageLocation, true);
  62.                                                 } else {
  63.                                                         SessionImages.MoveTempImage(oGdip.ImageLocation, SessionImages.CreateImagePath());
  64.                                                         if ((objPreferences['cUploadScreenshots'] == true && objPreferences['cUploadOptions'] === 0) ||
  65.                                                                 (SaveImage === false && objPreferences['cUploadOptions'] === 1) ||
  66.                                                                 (SaveImage === true && objPreferences['cUploadOptions'] === 2)) {
  67.                                                                 Ftp_UploadFile(oGdip.ImageLocation, false, objCWindow.ChatWnd, true);
  68.                                                         }
  69.                                                 }
  70.                                         }
  71.                                 }
  72.                         }
  73.                         CloseWindow(sWindow);
  74.                         oGdip.Uninitialize();
  75.                         sWindow = '';
  76.                        
  77.                         if (bMinimized === true) {
  78.                                 _win32.ShowWindow(hWnd, _win32._const._SW_SHOWMINIMIZED);
  79.                                 _win32.SetForegroundWindow(pre_hWnd);
  80.                                 bMinimized = false;
  81.                         }
  82.                         break;
  83.         }
  84. }

Version

  • 5.0.0070_20100325_publicbeta1

Developers

Project Details

  • Folders8
  • Files122
  • Total Lines11,867
  • Repository Version70

User Count

  • 162