MJTnet forum view script

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

MJTnet forum view script

Post by JRL » Thu Jun 08, 2006 5:03 pm

Hello World,

Not wanting to miss anything that happens on the MJTnet forum I acquired an RSS feed reader. But there are things about it I don't like. (I've only tried one) If I read a forum posting on the feed reader it doesn't record having been read on the forum so the forum view results are incorrect. Text, colored for emphasis in the forum, is plain black and white in the feed reader. Quoted and coded text that shows up in blocks on the forum is plain black and white text in the feed reader. If I want to add a response to a thread, I still have to log in to the forum, I can't do that from the feed reader. On the other hand, checking the forum for new postings every half hour isn't very productive either. So, I wrote a Macro Scheduler script solution. It seemed to be the right thing to do.

The following script opens two small dialog boxes. One reports the user count and the names of registered users currently logged into the forum, The other one checks for new posts and displays the count of new posts since the dialog's last update.

An INI file is created that records, among other things, each dialog's position on the screen, It has a total post count which is compared to the forum's post count. When these two numbers are different, the "new" post count is displayed on a button. When the button is selected, the forum is opened in your default web browser.

Each dialog can be minimized, when minimized there is no taskbar icon to select to bring them back, you simply re-run the script and they return to the screen. I have the script hotkey set to CTRL+Shift+F12 so for me, pressing CTRL+Shift+F12 either starts the script or unminimizes the dialogs. There will be flashing cogs in the taskbar when you run the script as-posted and they can also be used to unminimise the dialogs if needed.

The Thread Count dialog will unminimize itself if there are new posts on the forum. The Thread Count dialog also has a "snooze" feature. If you select snooze the dialog will not automatically unminimize for a preselected number of minutes. You can still manually unminimise the dialog.

Currently, the polling time is every 10 seconds. A dialog will ask you what time interval you want when you start the script. I recommend 60 seconds or more if you're on dialup access. Basically, your computer is calling the webpage every X seconds. Use your own judgemnet.

I haven't done it, but I would think this script could be easily adapted to any phpBB forum and possibly other non-phpBB forums as well.

Edit:06/09/06
Reposted script with an option to compile the scripts and run them as executables. You only need to check the box on the opening screen, the script will do the rest for you. If the option does not show up in the opening dialog, it means the script did not find the compile executable (msrt.exe) in the same folder as msched.exe.

They run much nicer as executables and there are no extra blinking cogs in the taskbar.

Comments, concerns, critcisms?

Later,
Dick

Code: Select all

//Set the following line to the location and name you
//choose to use for the ini file.  Or use the default.
Let>IniFileName=%TEMP_DIR%MS_reader.ini

IfFileExists>%IniFileName%
  //Do nothing
Else
  WriteLn>%IniFileName%,wresult,[thread]
  WriteLn>%IniFileName%,wresult,count=0
  WriteLn>%IniFileName%,wresult,seconds=10
  WriteLn>%IniFileName%,wresult,xpos=0
  WriteLn>%IniFileName%,wresult,ypos=0
  WriteLn>%IniFileName%,wresult,[snooze]
  WriteLn>%IniFileName%,wresult,minutes=10
  WriteLn>%IniFileName%,wresult,seconds=100
  WriteLn>%IniFileName%,wresult,snoozeon=0
  WriteLn>%IniFileName%,wresult,[users]
  WriteLn>%IniFileName%,wresult,seconds=10
  WriteLn>%IniFileName%,wresult,xpos=0
  WriteLn>%IniFileName%,wresult,ypos=50
EndIf

//Xpos and Ypos are the coordinates where the dialog will appear
//when the script is first executed,  if the dialog is moved and
//if the script is exited cleanly,  the last coordinates will be
//saved in the ini file and will be the new start location of
//the dialog.
ReadIniFile>%IniFileName%,snooze,snoozeon,Snooze_On
ReadIniFile>%IniFileName%,snooze,minutes,Snooze_Min

//Variable initialization
Let>snoozer=0
Let>RUset=0
Let>TCset=0
//Acquire the web site sample time interval in seconds from the ini file. 
ReadIniFile>%IniFileName%,thread,seconds,defsec

//////////////  Initialize snooze check/unminimize Thread Count ////////////
//Randomise snooze dialog name
Random>5000,DlgSnz
Let>DlgSnz=%DlgSnz%*100
Let>DialogSnooze=D1al0g%dlgSnz%

IfFileExists>%TEMP_DIR%~%dlgSnz%~.scp
  DeleteFile>%TEMP_DIR%~%dlgSnz%~.scp
EndIf

WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,ReadIniFile>%IniFileName%,thread,xpos,Xs
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,ReadIniFile>%IniFileName%,thread,ypos,Ys
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,ReadIniFile>%IniFileName%,snooze,snoozeon,Snooze_On
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,Let>MACRO_RESULT=0
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,Dialog>%DialogSnooze%
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Caption=      -~*Snooze*~-
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Width=200
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Height=135
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Top=CENTER
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Left=CENTER
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Close=0
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Resize=0
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Label=Snooze is on...,24,16
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Label=would you like to turn it off?,24,31
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Button=Yes,24,64,49,25,3
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,   Button=No,120,64,49,25,2
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,EndDialog>%DialogSnooze%

//If the script is already running and is executed a second time,
//the dialog box will be restored to its stored X,Y position
//(if it was minimized,) and then the second execution will quit.
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,IfWindowOpen>Thread Count
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,  If>Snooze_On=1
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,    Show>%DialogSnooze%,r%dlgSnz%
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,    If>r%dlgSnz%=3
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,      Let>MACRO_RESULT=wake
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,	 EndIf
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,	 If>r%dlgSnz%=2
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,	   Let>MACRO_RESULT=fini
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,	 EndIf
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,  Else
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,    Let>MACRO_RESULT=wake
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,  EndIf
WriteLn>%TEMP_DIR%~%dlgSnz%~.scp,wresult,EndIF

Macro>%TEMP_DIR%~%dlgSnz%~.scp

IfFileExists>%TEMP_DIR%~%dlgSnz%~.scp
  DeleteFile>%TEMP_DIR%~%dlgSnz%~.scp
EndIf

If>MACRO_RESULT=fini,finish
//////////////  End snooze check/unminimize Thread Count ////////////

IFW>Registered users:
//Xpos and Ypos are the coordinates where the dialog will appear
//when the script is first executed,  if the dialog is moved and
//if the script is exited cleanly,  the last coordinates will be
//saved in the ini file and will be the new start location of
//the dialog.
  ReadIniFile>%IniFileName%,users,xpos,userx
  ReadIniFile>%IniFileName%,users,ypos,usery
  WindowAction>0,Registered users:
  MoveWindow>Registered users:,%userx%,%usery%
  Let>RUset=1
EndIf

IFW>Thread Count
  EditIniFile>%IniFileName%,snooze,snoozeon,0
  EditIniFile>%IniFileName%,snooze,seconds,0
  ReadIniFile>%IniFileName%,thread,xpos,TCx
  ReadIniFile>%IniFileName%,thread,ypos,TCy
  WindowAction>0,Thread Count
  MoveWindow>Thread Count,%TCx%,%TCy%
  Let>TCset=1
EndIf

//Dialog to request settings
//RUset and TCset flags are set to 1 if the windows
//are already open.  In that case the setup dialogs below
//will not be called.
If>{(%RUset%=0)OR(%TCset%=0)}
Dialog>DialogNoComp
   Caption=Settings
   Width=223
   Height=187
   Top=CENTER
   Left=CENTER
   Close=0
   Resize=0
   Label=How many seconds%CRLF%between checks,40,8
   Edit=msEdit1,40,48,121,%defsec%
   Button=OK,8,120,75,25,3
   Button=Cancel,128,120,75,25,2
   Default=OK
EndDialog>DialogNoComp
Dialog>DialogComp
   Caption=Settings
   Width=223
   Height=187
   Top=CENTER
   Left=CENTER
   Close=0
   Resize=0
   Label=How many seconds%CRLF%between checks,40,8
   Edit=msEdit1,40,48,121,%defsec%
   CheckBox=msCheckBox1,Compile scripts?,40,80,97,False
   Button=OK,8,120,75,25,3
   Button=Cancel,128,120,75,25,2
   Default=OK
EndDialog>DialogComp

//Look for msrt.exe (the Macro Scheduler compiler)
//if found run the dialog that allows compile of script option
//if not found run the dialog that does not provide compile option.
Let>comp_line=%COMMAND_LINE%
RPL>%comp_line%,msched.exe,msrt.exe,comp_line
RPL>%comp_line%,",,comp_line
IfFileExists>%comp_line%
  show>dialogComp,r1
  Let>defsec=%DialogComp.msEdit1%
  If>%DialogComp.mscheckbox1%=True
    Let>compile_script=1
  Else
    Let>compile_script=0
  EndIF
  If>r1=2
    CloseDialog>DialogComp
    Goto>finish
  EndIF
Else
  show>dialogNoComp,r1
  Let>defsec=%DialogNoComp.msEdit1%
  Let>compile_script=0
  If>r1=2
    CloseDialog>DialogNoComp
    Goto>finish
  EndIF
EndIf

//Write time setting back to the ini file
  EditIniFile>%IniFileName%,thread,seconds,%defsec%

//Initialise and run "View Users"
  ReadIniFile>%IniFileName%,users,xpos,userx
  ReadIniFile>%IniFileName%,users,ypos,usery

//shorten path and file names
  Let>userexe=%TEMP_DIR%~ViewUsers~.exe
  Let>userfile=%TEMP_DIR%~ViewUsers~.scp
  Let>TCexe=%TEMP_DIR%~threadcount~.exe
  Let>TCfile=%TEMP_DIR%~threadcount~.scp

//If compile option is selected, delete the current scripts
//and current executables, if they exist.
  If>%compile_script%=1
    IfFileExists>%userexe%
      DeleteFile>%userexe%
    EndIf
	IfFileExists>%userfile%
      DeleteFile>%userfile%
    EndIf
	IfFileExists>%TCexe%
      DeleteFile>%TCexe%
    EndIf
	IfFileExists>%TCfile%
      DeleteFile>%TCfile%
    EndIf
  EndIf


//Run whatever program or script is available,  starting with
//executables, then scripts, then create and run scripts if they
//don't exist, then compile script and run if the option is selected. 
  IFW>Registered users:
    //Do Nothing
  Else
	EndIf
	IfFileExists>%userexe%
      Run>%userexe% -HIDE -NOSYSTRAY
    Else
      IfFileExists>%userfile%
        Exe>%userfile%
      Else
        GoSub>RunUsers
		If>%compile_script%=0
          Exe>%userfile%
		Else
		  Run>%comp_line% -COMPILE %userfile% %userexe% -QUIET -DEL
		  Run>%userexe% -HIDE -NOSYSTRAY
		EndIf
	  EndIf
	EndIf
  EndIf

  IFW>Thread Count
    //Do Nothing
  Else
	IfFileExists>%TCexe%
      Run>%TCexe% -HIDE -NOSYSTRAY
    Else
      IfFileExists>%TCfile%
        Exe>%TCfile%
      Else
        GoSub>RunCount
        If>%compile_script%=0
          Exe>%TCfile%
		Else
		  Run>%comp_line% -COMPILE %TCfile% %TCexe% -QUIET -DEL
		  Run>%TCexe% -HIDE -NOSYSTRAY
		EndIf
	  EndIf
	EndIf
  EndIf
EndIf
Label>finish

SRT>RunCount
//Dialog that reports any new web site activity.
//Button "XX New" (starts as "Reading") changes to report number of new entries.
//Button "Close" shuts down the script.
//Button "M" minimizes the dialog until this script is
//  reinvoked to bring the dialog out of minimize or
//  until a new post is detected where it will automatically
//  unminimize and report the new post
//Button "S" minimizes the dialog until this script is
//  reinvoked to bring the dialog out of minimize but will not
//  automatically unminimise for a given time period.

WriteLn>%TCfile%,wresult,   ReadIniFile>%IniFileName%,thread,xpos,Xt
WriteLn>%TCfile%,wresult,   ReadIniFile>%IniFileName%,thread,ypos,Yt
WriteLn>%TCfile%,wresult,   ReadIniFile>%IniFileName%,snooze,minutes,Snoozet_Min
WriteLn>%TCfile%,wresult,Dialog>Dialog3
WriteLn>%TCfile%,wresult,   Caption=Thread Count
WriteLn>%TCfile%,wresult,   Width=136
WriteLn>%TCfile%,wresult,   Height=55
WriteLn>%TCfile%,wresult,   Top=%Yt%
WriteLn>%TCfile%,wresult,   Left=%Xt%
WriteLn>%TCfile%,wresult,   CLOSE=0
WriteLn>%TCfile%,wresult,   RESIZE=0
WriteLn>%TCfile%,wresult,   Button=Reading,0,1,50,21,3
WriteLn>%TCfile%,wresult,   Button=Close,75,1,50,21,2
WriteLn>%TCfile%,wresult,   Button=M,55,14,15,12,5
WriteLn>%TCfile%,wresult,   Button=S,55,1,15,12,4
WriteLn>%TCfile%,wresult,   Default=Close
WriteLn>%TCfile%,wresult,EndDialog>Dialog3

WriteLn>%TCfile%,wresult,Dialog>Dialog6
WriteLn>%TCfile%,wresult,   Caption=Snooze Setting
WriteLn>%TCfile%,wresult,   Width=180
WriteLn>%TCfile%,wresult,   Height=150
WriteLn>%TCfile%,wresult,   Top=CENTER
WriteLn>%TCfile%,wresult,   Left=CENTER
WriteLn>%TCfile%,wresult,   Close=0
WriteLn>%TCfile%,wresult,   Resize=0
WriteLn>%TCfile%,wresult,   Label=How many minutes to snooze,16,24
WriteLn>%TCfile%,wresult,   Edit=msEdit1,56,48,55,%Snoozet_Min%
WriteLn>%TCfile%,wresult,   Button=OK,15,80,55,35,3
WriteLn>%TCfile%,wresult,   Button=Cancel,110,80,55,35,2
WriteLn>%TCfile%,wresult,   Default=OK
WriteLn>%TCfile%,wresult,EndDialog>Dialog6

WriteLn>%TCfile%,wresult,Let>dif=0
WriteLn>%TCfile%,wresult,Let>k=0
WriteLn>%TCfile%,wresult,Let>web=1
WriteLn>%TCfile%,wresult,Show>Dialog3
WriteLn>%TCfile%,wresult,Label>ActionLoop
WriteLn>%TCfile%,wresult,GetDialogAction>Dialog3,r3
WriteLn>%TCfile%,wresult,add>k,1
WriteLn>%TCfile%,wresult,if>r3=3,reset
WriteLn>%TCfile%,wresult,if>r3=2,exit
WriteLn>%TCfile%,wresult,if>r3=4
WriteLn>%TCfile%,wresult,  Show>dialog6,r6
WriteLn>%TCfile%,wresult,  If>r6=2,stopsnooze
WriteLn>%TCfile%,wresult,  resetdialogaction>dialog6
WriteLn>%TCfile%,wresult,  Let>snoozert=%Dialog6.msEdit1%*60
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,snooze,minutes,%Dialog6.msEdit1%
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,snooze,seconds,%snoozert%
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,snooze,snoozeon,1
WriteLn>%TCfile%,wresult,  Gosub>minimize
WriteLn>%TCfile%,wresult,  Label>stopsnooze
WriteLn>%TCfile%,wresult,  resetdialogaction>dialog3
WriteLn>%TCfile%,wresult,EndIf
WriteLn>%TCfile%,wresult,If>r3=5
WriteLn>%TCfile%,wresult,  Let>snoozert=0
WriteLn>%TCfile%,wresult,  Gosub>minimize
WriteLn>%TCfile%,wresult,EndIf

WriteLn>%TCfile%,wresult,If>{(%defsec%*100<%k%)or(%web%=1)}
WriteLn>%TCfile%,wresult,  GoSub>process
WriteLn>%TCfile%,wresult,EndIF

WriteLn>%TCfile%,wresult,Let>web=0
WriteLn>%TCfile%,wresult,Wait>0.01
WriteLn>%TCfile%,wresult,Goto>ActionLoop

WriteLn>%TCfile%,wresult,SRT>process
WriteLn>%TCfile%,wresult,  ReadIniFile>%IniFileName%,thread,count,prevqty
WriteLn>%TCfile%,wresult,  HTTPRequest>http://www.mjtnet.com/usergroup,,GET,,web
WriteLn>%TCfile%,wresult,  Let>k=0
WriteLn>%TCfile%,wresult,  Separate>web,Our users have posted a total of <b>,var
WriteLn>%TCfile%,wresult,  Separate>var_2,</b>,pvar
WriteLn>%TCfile%,wresult,  Let>postqty=%pvar_1%
  //Unremark the following 2 lines to create a forum post log file.
  //WriteLn>%TCfile%,wresult,GetTime>now
  //WriteLn>%TCfile%,wresult,WriteLn>%TEMP_DIR%post_quantity.log,wresult,%prevqty% %postqty% %now%
WriteLn>%TCfile%,wresult,  If>%postqty%>%prevqty%
WriteLn>%TCfile%,wresult,    If>{(%dif%<>%postqty%-%prevqty%)}
WriteLn>%TCfile%,wresult,	   Let>dif=%postqty%-%prevqty%
WriteLn>%TCfile%,wresult,      Let>Dialog3.msButton0=%dif% new
WriteLn>%TCfile%,wresult,	   If>snoozert=0
WriteLn>%TCfile%,wresult,	     WindowAction>0,Thread Count
WriteLn>%TCfile%,wresult,	     ReadIniFile>%IniFileName%,thread,xpos,Xt
WriteLn>%TCfile%,wresult,        ReadIniFile>%IniFileName%,thread,ypos,Yt
WriteLn>%TCfile%,wresult,        MVW>Thread Count,%Xt%,%Yt%
WriteLn>%TCfile%,wresult,	   EndIf
WriteLn>%TCfile%,wresult,    Else
    //The following lines are to reset count in the INI for deleted posts
WriteLn>%TCfile%,wresult,	   If>%postqty%<%prevqty%
WriteLn>%TCfile%,wresult,        EditIniFile>%IniFileName%,thread,count,%postqty%
WriteLn>%TCfile%,wresult,	   EndIf
WriteLn>%TCfile%,wresult,	 EndIf
WriteLn>%TCfile%,wresult,  Else
WriteLn>%TCfile%,wresult,    Let>Dialog3.msButton0=%dif% new
WriteLn>%TCfile%,wresult,  EndIf
WriteLn>%TCfile%,wresult,  Let>web=0
WriteLn>%TCfile%,wresult,END>process

WriteLn>%TCfile%,wresult,SRT>minimize
WriteLn>%TCfile%,wresult,  Let>WF_TYPE=0
WriteLn>%TCfile%,wresult,  GWP>Thread Count,Xt,Yt
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,thread,xpos,%Xt%
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,thread,ypos,%Yt%
WriteLn>%TCfile%,wresult,  MVW>Thread Count,0,-100
WriteLn>%TCfile%,wresult,  ResetDialogAction>Dialog3
WriteLn>%TCfile%,wresult,  Let>WF_TYPE=1
WriteLn>%TCfile%,wresult,  If>%snoozert%>0
WriteLn>%TCfile%,wresult,   Repeat>snoozert
WriteLn>%TCfile%,wresult,	  ReadIniFile>%IniFileName%,snooze,seconds,snoozert
WriteLn>%TCfile%,wresult,	  sub>snoozert,1
WriteLn>%TCfile%,wresult,	  EditIniFile>%IniFileName%,snooze,seconds,%snoozert%
WriteLn>%TCfile%,wresult,	  Wait>0.8
WriteLn>%TCfile%,wresult,	Until>snoozert<1
WriteLn>%TCfile%,wresult,  EndIf
WriteLn>%TCfile%,wresult,  Let>snoozert=0
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,snooze,seconds,0
WriteLn>%TCfile%,wresult,  EditIniFile>%IniFileName%,snooze,snoozeon,0
WriteLn>%TCfile%,wresult,End>minimize

WriteLn>%TCfile%,wresult,SRT>reset
WriteLn>%TCfile%,wresult,EditIniFile>%IniFileName%,thread,count,%postqty%
WriteLn>%TCfile%,wresult,ReadIniFile>%IniFileName%,thread,count,prevqty
WriteLn>%TCfile%,wresult,Let>dif=0
WriteLn>%TCfile%,wresult,Let>Dialog3.msButton0=%dif% new
WriteLn>%TCfile%,wresult,Let>postqty=%prevqty%
WriteLn>%TCfile%,wresult,Wait>0.1
WriteLn>%TCfile%,wresult,ResetDialogAction>Dialog3
WriteLn>%TCfile%,wresult,EXE>http://www.mjtnet.com/usergroup/
WriteLn>%TCfile%,wresult,END>reset

WriteLn>%TCfile%,wresult,Label>exit
//Unremark the following 5 lines to have the forum article count update on close
/*
  WriteLn>%TCfile%,wresult,HTTPRequest>http://www.mjtnet.com/usergroup,,GET,,web
  WriteLn>%TCfile%,wresult,Separate>web,Our users have posted a total of <b>,var
  WriteLn>%TCfile%,wresult,Separate>var_2,</b>,pvar
  WriteLn>%TCfile%,wresult,Let>postqty=%pvar_1%
  WriteLn>%TCfile%,wresult,EditIniFile>%IniFileName%,thread,count,%postqty%
*/
WriteLn>%TCfile%,wresult,GWP>Thread Count,Xt,Yt
WriteLn>%TCfile%,wresult,If>y=-100
WriteLn>%TCfile%,wresult,  Let>Y=0
WriteLn>%TCfile%,wresult,EndIF
WriteLn>%TCfile%,wresult,EditIniFile>%IniFileName%,thread,xpos,%Xt%
WriteLn>%TCfile%,wresult,EditIniFile>%IniFileName%,thread,ypos,%Yt%
WriteLn>%TCfile%,wresult,Label>finish
END>RunCount


SRT>RunUsers
//Script that reports the number of users currently on the forum
WriteLn>%userfile%,wresult,ReadIniFile>%IniFileName%,users,xpos,Xu
WriteLn>%userfile%,wresult,ReadIniFile>%IniFileName%,users,ypos,Yu

WriteLn>%userfile%,wresult,IFW>Registered users:
WriteLn>%userfile%,wresult,  MoveWindow>Registered users:,%Xu%,%Yu%
WriteLn>%userfile%,wresult,  Goto>finish
WriteLn>%userfile%,wresult,EndIf

WriteLn>%userfile%,wresult,Dialog>Dialog_a
WriteLn>%userfile%,wresult,   Caption=Registered users:
WriteLn>%userfile%,wresult,   Width=400
WriteLn>%userfile%,wresult,   Height=45
WriteLn>%userfile%,wresult,   Top=%Yu%
WriteLn>%userfile%,wresult,   Left=%Xu%
WriteLn>%userfile%,wresult,   Close=0
WriteLn>%userfile%,wresult,   Label=Not yet connected,40,1
WriteLn>%userfile%,wresult,   Button=--,1,1,15,12,3
WriteLn>%userfile%,wresult,   Button=X,20,1,15,12,2
WriteLn>%userfile%,wresult,   Default=--
WriteLn>%userfile%,wresult,EndDialog>Dialog_a

WriteLn>%userfile%,wresult,Let>userlist=Not yet connected
WriteLn>%userfile%,wresult,Let>timespan=%defsec%
WriteLn>%userfile%,wresult,Let>web=0
WriteLn>%userfile%,wresult,Let>k=0

WriteLn>%userfile%,wresult,Show>Dialog_a
WriteLn>%userfile%,wresult,Label>start

WriteLn>%userfile%,wresult,GetDialogAction>Dialog_a,aresult
WriteLn>%userfile%,wresult,If>aresult=2,finish
WriteLn>%userfile%,wresult,If>aresult=3
WriteLn>%userfile%,wresult,  GWP>Registered users:,Xu,Yu
WriteLn>%userfile%,wresult,  If>Yu=-2000
WriteLn>%userfile%,wresult,    //Do nothing
WriteLn>%userfile%,wresult,  Else
WriteLn>%userfile%,wresult,    EditIniFile>%IniFileName%,users,xpos,%Xu%
WriteLn>%userfile%,wresult,    EditIniFile>%IniFileName%,users,ypos,%Yu%
WriteLn>%userfile%,wresult,  EndIF
WriteLn>%userfile%,wresult,  MoveWindow>Registered users:,0,-2000
WriteLn>%userfile%,wresult,EndIf
WriteLn>%userfile%,wresult,Let>kk=1
WriteLn>%userfile%,wresult,If>{(%k%=1000)or(%web%=0)}
WriteLn>%userfile%,wresult,  Gosub>usercount
WriteLn>%userfile%,wresult,EndIf


WriteLn>%userfile%,wresult,Let>Dialog_a.msLabel0=%userlist%

WriteLn>%userfile%,wresult,add>k,1

WriteLn>%userfile%,wresult,ResetDialogAction>Dialog_a
WriteLn>%userfile%,wresult,Wait>0.01
WriteLn>%userfile%,wresult,Goto>start

WriteLn>%userfile%,wresult,SRT>usercount
WriteLn>%userfile%,wresult,  HTTPRequest>http://www.mjtnet.com/usergroup,,GET,,web
WriteLn>%userfile%,wresult,  Separate>web,In total there are <b>,ctvar
WriteLn>%userfile%,wresult,  Separate>ctvar_2,</b> users online,ctvar
WriteLn>%userfile%,wresult,  Let>userlist=Total:%ctvar_1% Reg:
WriteLn>%userfile%,wresult,  Separate>web,/>Registered Users:,var
WriteLn>%userfile%,wresult,  Separate>var_2,</span></td>,pvar
WriteLn>%userfile%,wresult,  MidStr>pvar_1,1,9,usertest
WriteLn>%userfile%,wresult,  If>usertest= <a href=
WriteLn>%userfile%,wresult,    Separate>pvar_1,">,var
WriteLn>%userfile%,wresult,	Repeat>kk
WriteLn>%userfile%,wresult,	  add>kk,1
WriteLn>%userfile%,wresult,	  Let>userclean=var_%kk%
WriteLn>%userfile%,wresult,	  Separate>userclean,</a>,username
WriteLn>%userfile%,wresult,	  Let>userclean=username_1
WriteLn>%userfile%,wresult,	  Concat>userlist,  %userclean%
WriteLn>%userfile%,wresult,	Until>kk,var_count
WriteLn>%userfile%,wresult,  Else>
WriteLn>%userfile%,wresult,    Concat>userlist,None...
WriteLn>%userfile%,wresult,  EndIF
WriteLn>%userfile%,wresult,  RPL>%userlist%,<b>,,userlist
WriteLn>%userfile%,wresult,  RPL>%userlist%,</b>,,userlist
WriteLn>%userfile%,wresult,  Let>web=1
WriteLn>%userfile%,wresult,  Let>k=0
WriteLn>%userfile%,wresult,END>usercount

WriteLn>%userfile%,wresult,Label>finish
WriteLn>%userfile%,wresult,GWP>Registered users:,Xu,Yu
WriteLn>%userfile%,wresult,If>y=-2000
WriteLn>%userfile%,wresult,  //Do nothing
WriteLn>%userfile%,wresult,Else
WriteLn>%userfile%,wresult,EditIniFile>%IniFileName%,users,xpos,%Xu%
WriteLn>%userfile%,wresult,EditIniFile>%IniFileName%,users,ypos,%Yu%
WriteLn>%userfile%,wresult,EndIF
END>RunUsers
Last edited by JRL on Fri Jun 09, 2006 2:26 pm, edited 3 times in total.

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jun 08, 2006 6:46 pm

One more item to note: For this script to work, the .SCP filetype must be associated with Macro Scheduler. When you installed Macro Scheduler, this association took place automatically unless you specifically denied it. So if you are in doubt about what I'm refering to, it is probably not a problem.

Later,
Dick

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: MJTnet forum view script

Post by JRL » Mon Apr 28, 2014 4:51 pm

The forums were updated today (April 28, 2014). Since the forum's source html is now completely different, the old forum watching script will no longer work. So here's a new one that is a little less functional (no snooze for example) but will still report changes to the forum.

This script's function is to present a dialog that displays the current count of new posts and the current users on the forum. The script requires Macro Scheduler version 14.1. It makes use of the new html viewer object added to dialogs in March 2014. Once the script is run and the dialog displays, clicking the leftmost button will bring up the Macro Scheduler forum in your default browser. If you want to change the location for the dialog you will need to edit the ini file manually. The file is kept in your temp folder and is named MS_reader.ini.

Hopefully someone will find this useful.

Code: Select all

IfFileExists>%temp_dir%MS_reader.ini
  ReadIniFile>%temp_dir%MS_reader.ini,thread,xpos,Xt
  ReadIniFile>%temp_dir%MS_reader.ini,thread,ypos,Yt
  ReadIniFile>%temp_dir%MS_reader.ini,thread,seconds,St
Else
  WriteLn>%temp_dir%MS_reader.ini,wres,[thread]%crlf%count=0%crlf%seconds=60%crlf%xpos=0%crlf%ypos=0
EndIf
Dialog>Dialog3
object Dialog3: TForm
  Left = 562
  Top = 347
  HelpContext = 5000
  AutoSize = True
  BorderIcons = [biSystemMenu]
  BorderStyle = bsNone
  Caption = 'Thread Count'
  ClientHeight = 121
  ClientWidth = 801
  Color = 16777200
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object MSHTMLViewer1: tMSHTMLViewer
    Left = 0
    Top = 15
    Width = 500
    Height = 65
    TabOrder = 2
    BorderStyle = htFocused
    DefFontName = 'Times New Roman'
    DefPreFontName = 'Courier New'
    HistoryMaxCount = 0
    NoSelect = False
    PrintMarginBottom = 2.000000000000000000
    PrintMarginLeft = 2.000000000000000000
    PrintMarginRight = 2.000000000000000000
    PrintMarginTop = 2.000000000000000000
    PrintScale = 1.000000000000000000
    Visible = False
  end
  object msButton1: tMSButton
    Left = 0
    Top = 0
    Width = 70
    Height = 20
    Caption = 'Reading'
    TabOrder = 0
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object msButton2: tMSButton
    Left = 72
    Top = 0
    Width = 70
    Height = 20
    Caption = 'Close'
    TabOrder = 1
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog3

SetDialogProperty>Dialog3,,Left,Xt
SetDialogProperty>Dialog3,,Top,Yt
AddDialogHandler>Dialog3,msButton1,OnClick,GoToMJTnet
AddDialogHandler>Dialog3,msButton2,OnClick,Quit
AddDialogHandler>Dialog3,,OnClose,Quit

Let>dif=0
Show>Dialog3
GoSub>process

Label>ActionLoop
Timer>EndTime
Let>TotalTime=%EndTime%-%StartTime%

If>{%TotalTime%>(%St%*1000)}
  GoSub>process
EndIF

Wait>0.01
Goto>ActionLoop
SRT>process
  ReadIniFile>%temp_dir%MS_reader.ini,thread,count,prevqty
  HTTPRequest>http://direct.mjtnet.com/usergroup/,,GET,,web
  If>web=404 Error connecting to host
    HTTPRequest>http://mjtnet.com/usergroup/,,GET,,web
  EndIf
  Separate>web,<p>Total posts <strong>,var
  Separate>var_2,</strong>,pvar
  Let>postqty=%pvar_1%
  If>%postqty%>%prevqty%
    If>{(%dif%<>%postqty%-%prevqty%)}
       Let>dif=%postqty%-%prevqty%
       SetDialogProperty>Dialog3,msButton1,Caption,%dif% new
    Else
       If>%postqty%<%prevqty%
        EditIniFile>%temp_dir%MS_reader.ini,thread,count,%postqty%
       EndIf
     EndIf
  Else
    SetDialogProperty>Dialog3,msButton1,Caption,%dif% new
  EndIf

  Separate>web,<h3>Who is online</h3>,ctvar
  Separate>ctvar_2,Most users ever online was <strong>,ctvar
  Let>UserList=<html><body bgcolor="#F0FFFF">%ctvar_1%
  
  Separate>web,Registered users:,ctvar
  Separate>ctvar_2,<em>Legend:,ctvar
  Concat>UserList,%ctvar_1% </body></html>
  
  StringReplace>UserList,(based on users active over the past 5 minutes),,UserList

  SetDialogProperty>Dialog3,MSHTMLViewer1,HTML,userlist
  SetDialogProperty>Dialog3,MSHTMLViewer1,Visible,True
  Timer>StartTime
END>process
SRT>GoToMJTnet
  EditIniFile>%temp_dir%MS_reader.ini,thread,count,%postqty%
  ReadIniFile>%temp_dir%MS_reader.ini,thread,count,prevqty
  Let>dif=0
  SetDialogProperty>Dialog3,msButton1,Caption,%dif% new
  Let>postqty=%prevqty%
  Wait>0.1
  EXE>http://www.mjtnet.com/usergroup/
END>GoToMJTnet
SRT>Quit
  GetWindowPos>Thread Count,Xt,Yt
  EditIniFile>%temp_dir%MS_reader.ini,thread,xpos,%Xt%
  EditIniFile>%temp_dir%MS_reader.ini,thread,ypos,%Yt%
  Exit>0
END>Quit
Last edited by Marcus Tettmar on Tue Apr 29, 2014 2:39 pm, edited 2 times in total.
Reason: Static path still in script on some lines: C:\DOCUME~1\dickl\LOCALS~1\Temp. Replaced with %temp_dir%

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: MJTnet forum view script

Post by Dorian (MJT support) » Tue Apr 29, 2014 3:27 pm

I didn't see this the first time around, and all I have to say is "wow".

All these years later and I'm still not a fan of RSS feed readers.

Have you tried Tapatalk yet?

Sent from my SPH-L710 using Tapatalk
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: MJTnet forum view script

Post by JRL » Tue Apr 29, 2014 3:39 pm

This is the only forum I visit regularly and I've been using the MJTnet forum view script since 2006. Have not tried Tapatalk. but you are using it and you said "I didn't see this the first time around".

I don't miss anything.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: MJTnet forum view script

Post by Dorian (MJT support) » Tue Apr 29, 2014 3:42 pm

Haha, yes, good point... But we only installed the Tapatalk module on the forum yesterday.

Sent from my SPH-L710 using Tapatalk
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: MJTnet forum view script

Post by JRL » Tue Apr 29, 2014 3:49 pm

Sorry. I didn't know.

I'll give it a shot and see if I like it. As I said eight years ago at the start of this thread, the script was born from disdain for the available feed readers. So I'm starting from a "low expectations" point of view.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: MJTnet forum view script

Post by Marcus Tettmar » Tue Apr 29, 2014 3:50 pm

Tapatalk just makes it easy to monitor/reply to the forums from a mobile phone. I doubt anyone other than the admins will need that. Most people will want help while on their desktops since macro scheduler doesn't run on a phone. Doubt many users will need to look at the forums from their mobiles. But I may be wrong.

Sent from my GT-I9100 using Tapatalk
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: MJTnet forum view script

Post by Dorian (MJT support) » Tue Apr 29, 2014 5:21 pm

JRL wrote:Sorry. I didn't know.

I'll give it a shot and see if I like it. As I said eight years ago at the start of this thread, the script was born from disdain for the available feed readers. So I'm starting from a "low expectations" point of view.

I hope my reply didn't come across as terse. I found your response rather witty, so my reply was written with a smile on my face. :)

Marcus is right, and Tapatalk certainly has it's limitations, especially regarding any actual scripting.

What I like about it though, is that I can monitor all my various forums from one phone/tablet app, and it's great for catching up and shooting off quick replies.

It has some quite flexible viewing options (starred threads, ones you've participated in, new, unread, time line, etc), plus it can also amalgamate all subscribed forums into one time line. Although that's a pain if one of them is the Windows8 forum with 12 zillion new posts per day.

Sent from my SPH-L710 using Tapatalk
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: MJTnet forum view script

Post by JRL » Tue Apr 29, 2014 5:57 pm

No terse taken.

My cell phone is just a cell phone so I guess I'm not a good candidate for the application. Thanks for the explanation. Someone is bound to find the info useful.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts