WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

eBay Pager

 Keywords: ebay auction send email postie notify 

Sends you an email prior to eBay auction ending.

This script requires these files:

Make sure you configure the INI with your SMTP port 25 only settings.Configure receiver of email, including any cell phone text messages, ex: 3215551234@txt.att.net. Schedule this task to run at startup on a machine with continuous internet access.

eBay_Pager.wbt

;==================================================================================================
; eBay-Pager.wbt  v2.0  2009-07-27                     (c)20090727.Joe Bybee, MCSE², MCP+I, CNA, A+
;==================================================================================================
;
; Sends you an email an hour / 30 mins / 10 mins prior to eBay auction ending.
;
; Make sure you configure the INI with your SMTP port 25 only settings.
; Configure receiver of email, including any cell phone text messages, ex: 3215551234@txt.att.net
; Schedule this task to run at startup on a machine with continuous internet access.
;
; Highlight the Date/Time the auction ENDS and paste into the INI.
; The program will query these fields to determine when to send alert.
;
;  =============================================================================================
;
;VER_NUM="1.0" ; 2008-07-14 Creation.
VER_NUM="2.0"  ; 2009-07-27 eBay changed format from Jul-27-09  to Jul 27, 2009, Fixed Read ini.
;
;
;DebugTrace(@on,"trace.txt")
;
;
;ErrorMode(@OFF)
;SvcSetAccept(32768) ; specifies that this service will only accept logoff notifications.
;
;Int38  -1 Don't change     0 Disable quiet mode    1 Enable quiet mode.      "" = log file name for errors.
;
;IntControl(38, 1, "", 0, 0) ; runs quiet
IntControl(1002,0,0,0,0) ; runs hidden
IntControl(12,5,0,0,0) ; exit windows without asking to close script
;
;IntControl (1008, 0, 0, 0, 0) ; disables the CLOSE button for winbatch dialog boxes.
;
;
;
;IntControl (33, 0, 0, 0, 0) ; disables multiple selections in the ITEMLISTBOX.  Filelist box doesn't allow multiple selections.
;
;
;WBT_DIR=IntControl(1004,0,0,0,0)   ; gets current winbatch dir
;
;
;
; ****************************************************************************************************************
;
;               Initialize variables
;
; ****************************************************************************************************************
;
CR = Num2Char(13)                         ;13 is a carriage-return
LF = Num2Char(10)                         ;10 is a line feed
;
;
;
CURR_DIR = DirGet()
THIS_PATH=DirHome() ; includes last backslash
;
INI_FILE=StrCat(CURR_DIR,"eBay_Pager.ini")
;
LOG_FILE=StrCat(CURR_DIR,"eBay_Pager.log")
;
;
;
CTRL_KEY=IsKeyDown(@CTRL & @SHIFT)
;
If CTRL_KEY == @YES Then
   ;
   RunShell("NOTEPAD.EXE", LOG_FILE, CURR_DIR, @NORMAL, @NOWAIT)
   ;
   Exit
EndIf
;
;
SHIFT_KEY=IsKeyDown(@SHIFT)
;
;
If SHIFT_KEY == @YES Then
   ;
   RunShell("NOTEPAD.EXE", INI_FILE, CURR_DIR, @NORMAL, @NOWAIT)
   ;
   Exit
EndIf
;
;
;
;
INI_EXIST=FileExist(INI_FILE)
;
If INI_EXIST == 0 Then
   ;
   Message("ERROR","eBay_Pager INI file missing")
   Exit;
   ;
EndIf
;
;
;
YR_MD_HMS=TimeYmdHms()
;
END_LOG=0
;
;      FILE_SIZE=FileSizeEx(XLS_FILE, 0)
File_Size=FileSizeEx(LOG_FILE,0)
;
If FILE_SIZE > 150000 Then
   ;
   FileDelete(LOG_FILE);  <------- clean up logs
   ;
EndIf
;
;
;
FIRST_PAGE=0
SECOND_PAGE=0
THIRD_PAGE=0
;
;
;
HOUR_DIFF=IniReadPvt("EBAY","HOURDIFF","",INI_FILE)    ; Jul 28 2008 13:26:18 PDT
;
TIME_DIFF=StrCat("0000:00:00:0",HOUR_DIFF,":00:00")
;
;
While 1
   ;
   ;
   YR_MD_HMS=TimeYmdHms()
   ;
   If INI_EXIST == 1 Then
      ;
      SEND_TO=IniReadPvt("EBAY","EMAIL","0",INI_FILE)
      ;
      WAIT_TIME=IniReadPvt("EBAY","WAIT","60",INI_FILE)
      ;
      RELAY_ADDR=IniReadPvt("EBAY","RELAY","",INI_FILE)
      ;
      RELAY_USER=IniReadPvt("EBAY","USER","",INI_FILE)
      ;
      RELAY_PW=IniReadPvt("EBAY","PASS","",INI_FILE)
      ;
      EMAIL_FROM=IniReadPvt("EBAY","FROM","eBay@Pager.net",INI_FILE)
      ;
      EMAIL_ESMTP=IniReadPvt("EBAY","ESMTP","1",INI_FILE)
      ;
      CRAM_MD5=IniReadPvt("EBAY","CRAM_MD5","0",INI_FILE)
      ;
      TEST_EMAIL=IniReadPvt("EBAY","TEST","0",INI_FILE)
   EndIf
   ;
   ;
   If TEST_EMAIL==1 Then
      ;
      TIME_DIFF_MINS="TEST"
      CURR_NOTE="TEST"
      GoSub PAGE_ME
      ;
      If SEND_ERROR == 0
         ERROR_INFO=kStatusInfo()
         Display(10,"eMail Send Error",ERROR_INFO)
      EndIf
      ;
      TimeDelay(30)
      ;
      Continue
   EndIf
   ;
   For LOOP_CT = 1 To 10
      ;
      INI_VAR=StrCat("TIME",LOOP_CT)
      ;
      CURR_TIME=IniReadPvt("EBAY",INI_VAR,"",INI_FILE)    ; Jul 28 2008 13:26:18 PDT
      ;
      INI_VAR=StrCat("NOTE",LOOP_CT)
      ;
      CURR_NOTE=IniReadPvt("EBAY",INI_VAR,"",INI_FILE)    ; Jul 28 2008 13:26:18 PDT
      ;
      ;
      If CURR_TIME != "" Then
         ;
         CURR_TIME=StrUpper(CURR_TIME)            ; JUL 31, 200912:26:31 PDT    <-- Auction End from eBay
         ;
         CURR_TIME=StrReplace(CURR_TIME, ",","")     ; JUL 28 200912:26:31 PDT
         ;
         CURR_TIME=StrReplace(CURR_TIME," ",":")      ; JUL:28:200912:26:31:PDT
         ;
         If ItemCount(CURR_TIME, ":" ) == 6 Then      ;         1  2   3   4  5  6  7
            CURR_TIME=StrInsert(CURR_TIME, ":", "", 12, 1)  ; JUL:28:2009:12:26:31:PDT
         EndIf
         ;                                1   2  3   4  5  6
         CURR_TIME=StrReplace(CURR_TIME,":PDT","")    ; JUL:28:2009:12:26:18
         ;
         CURR_MONTH=ItemExtract(1, CURR_TIME, ":" )
         ;                       1   2   3   4   5   6   7   8   9  10   11  12
         CURR_MONTH=ItemLocate(CURR_MONTH,"JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC",",")
         ;
         ;
         If StrLen(CURR_MONTH) < 10 Then
            CURR_MONTH=StrCat("0",CURR_MONTH)
         EndIf
         ;
         CURR_YEAR=ItemExtract(3, CURR_TIME, ":")
         CURR_DAY=ItemExtract(2, CURR_TIME, ":")
         CURR_HR=ItemExtract(4, CURR_TIME, ":")
         CURR_MIN=ItemExtract(5, CURR_TIME, ":")
         CURR_SEC=ItemExtract(6, CURR_TIME, ":")
         ;
         CURR_TIME=StrCat(CURR_YEAR,":",CURR_MONTH,":",CURR_DAY,":",CURR_HR,":",CURR_MIN,":",CURR_SEC) ; 2009:07:28:12:26:18
         ;
         CURR_TIME=StrTrim(CURR_TIME)
         ;
         If StrLen(CURR_TIME) == 19 Then
            ;
            ;
            If HOUR_DIFF > 0 Then
               CURR_TIME=TimeAdd(CURR_TIME,TIME_DIFF) ; convert to PDT eBay time
            EndIf
            ;
            If HOUR_DIFF < 0 Then
               CURR_TIME=TimeSubtract(CURR_TIME,TIME_DIFF) ; convert to PDT eBay time
            EndIf
            ;
            ;
            TIME_DIFF_SECS=TimeDiffSecs(CURR_TIME,YR_MD_HMS)
            ;
            ;
            If TIME_DIFF_SECS < 3600 && TIME_DIFF_SECS > 1800 && TIME_DIFF_SECS > 0 && FIRST_PAGE == 0 Then
               FIRST_PAGE=1
               TIME_DIFF_MINS=60
               GoSub PAGE_ME
            EndIf
            ;
            ;
            If TIME_DIFF_SECS < 1800 && TIME_DIFF_SECS > 600 && TIME_DIFF_SECS > 0 && SECOND_PAGE == 0 Then
               SECOND_PAGE=1
               TIME_DIFF_MINS=30
               GoSub PAGE_ME
            EndIf
            ;
            ;
            If TIME_DIFF_SECS < 600 && TIME_DIFF_SECS > 0 && THIRD_PAGE == 0 Then
               TIME_DIFF_MINS=10
               GoSub PAGE_ME
               ;
               TimeDelay(600)
               ;
               FIRST_PAGE=0
               SECOND_PAGE=0
               THIRD_PAGE=0
               ;
            EndIf
         ;
         EndIf
      ;
      EndIf
      ;
   Next LOOP_CT
   ;
   ;
   ;
   TimeDelay(WAIT_TIME)
   ;
EndWhile




:PAGE_ME
   SEND_TO=StrReplace(SEND_TO,"-","")
   SEND_TO=StrReplace(SEND_TO," ","")
   SEND_TO=StrReplace(SEND_TO,";","|")
   ;
   ;Message("Mobile Number",strcat(INI_SECT,"'s mobile number is: ",CURR_CELL,".","%CR%%LF%%CR%%LF%",INI_SECT,"'s pager number is: ",CURR_PAGER))
   ;
   AddExtender("WWPST44I.DLL")
   SMTP_RELAY=RELAY_ADDR
   SMTP_FROM=EMAIL_FROM
   SMTP_USER=RELAY_USER
   SMTP_PSWD=RELAY_PW
   SMTP_PORT=25
   SMTP_TO=SEND_TO
   SMTP_CC=""
   SMTP_BCC=""
   SMTP_SUBJ="eBay %TIME_DIFF_MINS% mins."
   ;
   SMTP_MSG=StrCat("eBay Auction ends in %TIME_DIFF_MINS% mins.<br><br>",CURR_NOTE)
   ;
   SMTP_ATTACH=""

   ;flags=h for html, d for delivery status, m for read receipt, 1 high priority, 2 low priority
   SMTP_FLAGS="ha"
   ;
   If EMAIL_ESMTP==1 Then
      SMTP_FLAGS=StrCat(SMTP_FLAGS,"e")
   EndIf
   ;
   If CRAM_MD5==1 Then
      SMTP_FLAGS=StrCat(SMTP_FLAGS,"c")
   EndIf
   ;

   kInit(SMTP_RELAY,SMTP_FROM,SMTP_USER,SMTP_PSWD,SMTP_PORT)
   kDest(SMTP_TO,SMTP_CC,SMTP_BCC)
   SEND_ERROR=kSendText(SMTP_SUBJ,SMTP_MSG,SMTP_ATTACH,SMTP_FLAGS)
   ;
   ;
   APPEND_TXT=StrCat(YR_MD_HMS, " - Sending Page.  Auction Ends in ",TIME_DIFF_MINS," mins.") ;creates comma delimited line for log
   GoSub LOG_FILE
Return

; =============================================================================================================== LOG
;
;                           WRITE TO LOG FILE
;
; =============================================================================================================== LOG
;
:LOG_FILE
;
IN_USE = FileExist(LOG_FILE)
;
While IN_USE == 2
     RANDOM_NUM = Random(15)
     ;Display(2, " CLOSE GET_CPR.LOG ", "Waiting %RANDOM_NUM% seconds for GET_CPR.LOG to close")     ; waits till log file is NOT in use.
     ;
     TimeDelay(RANDOM_NUM)
     IN_USE = FileExist(LOG_FILE)
EndWhile
;
If SEND_ERROR == 0
   ERROR_INFO=kStatusInfo()
   Display(10,"eBay Pager Error",ERROR_INFO)
   APPEND_TXT=StrCat(APPEND_TXT,"%CR% %ERROR_INFO%")
EndIf

LOG_HNDL=FileOpen(LOG_FILE,"APPEND")
;
FileWrite(LOG_HNDL,APPEND_TXT)
;
If END_LOG == 1 Then
   FileWrite(LOG_HNDL,"-------------------------------------------------------------")
EndIf
;
FileClose(LOG_HNDL)
;
TimeDelay(2)
;
Return ; return to GoSub Line
;
;


eBay_Pager.ini

[EBAY]

*** This program will send you 3 text messages / emails (One Hour / 30 mins / 10 mins)
*** It will process all 10 below.  If any expire within the above intervals, it will send email.
*** Any old times will be ignored.  Times below can be in any order.

*** Configure this INI file below, including the SMTP relay settings (non SSL only)
*** Save the INI and then launch the EXE.  To kill the program, End Task in Task Mgr


*** TIMES MUST BE IN EBAY FORMAT:  Jul 23, 200809:22:20 PDT. 
*** HIGHLIGHT the END Time at the Top of the Auction, 
*** and Right Click Copy and Paste below.  Times can be skipped, it will query all 10.

Time1=Jul 26, 200915:30:12 PDT
Note1=Laptop Parts
Time2=
Note2=
Time3=
Note3=
Time4=
Note4=
Time5=
Note5=
Time6=
Note6=
Time7=
Note7=
Time8=
Note8=
Time9=
Note9=
Time10=
Note10=


*** How many hours Ahead is your Time Zone from PDT?   Can be negative number.
*** Example CST is 2 hours ahead of PDT, so set to 2.  If in PDT set to 0.

HOURDIFF=2

*** Use   ;    as a delimeter for multiple notification emails.  Cell Phone Example:  3215551234@txt.att.net

EM

*** How Long to wait in seconds before checking above times again.  Keep it below 120.

WAIT=60


*** Some Relays require full FROM address: user@domain.com

FROM=eBay@Pager.net


*** Email Relay can NOT be SSL, port 25 only.

RELAY=smtp.server.com
USER=user@server.com
PASS=password

*** Enhanced SMTP posting, requiring logon authentication) with AUTH-PLAIN authentication 
*** (password sent through as plain text and not encrypted).
*** Default = 1

ESMTP=1

*** CRAM-MD5 Logon Authentication - Default is 0

CRAM_MD5=0

*** if TEST=1 the program will send a test email every 30 seconds.
*** Tweak the relay settings above and re-save.  
*** The program will read the newest settings every 30 seconds and try again.

TEST=0


Article ID:   W18244
Filename:   eBay Pager.txt
File Created: 2009:07:29:09:15:48
Last Updated: 2009:07:29:09:15:48