Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #10172 > unrolled thread
| Started by | zodcomag@gmail.com |
|---|---|
| First post | 2017-02-19 23:49 -0800 |
| Last post | 2017-02-21 08:07 -0800 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
Set alarm in windows zodcomag@gmail.com - 2017-02-19 23:49 -0800
Re: Set alarm in windows "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2017-02-20 15:14 +0100
Re: Set alarm in windows zodcomag@gmail.com - 2017-02-20 08:33 -0800
Re: Set alarm in windows D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-02-20 18:18 +0100
Re: Set alarm in windows "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2017-02-20 21:03 +0100
Re: Set alarm in windows Franz Rachbauer <office@rachbauer.org> - 2017-02-21 07:08 +0100
Re: Set alarm in windows Willie Moore <williem@wmconsulting.com> - 2017-02-21 09:34 -0600
Re: Set alarm in windows Sherlock <sherlock@sherlock.com.au> - 2017-02-21 08:07 -0800
| From | zodcomag@gmail.com |
|---|---|
| Date | 2017-02-19 23:49 -0800 |
| Subject | Set alarm in windows |
| Message-ID | <ee184ab7-1d62-4d82-916f-35c19e05b4e4@googlegroups.com> |
How can I set an alarm in windows from VO? Thanks Henry
[toc] | [next] | [standalone]
| From | "Urs Eggmann" <Urs.Eggmann@shinternet.ch> |
|---|---|
| Date | 2017-02-20 15:14 +0100 |
| Message-ID | <eh0c09Fpq8uU1@mid.individual.net> |
| In reply to | #10172 |
Hy Henry,
Install in the appropriate Window a timer (SetTimer()) in the Init-Method:
SetTimer(SELF:handle( ) ,1, 1000 , NULL_PTR) // This timer gives one-second
impulses
In the Dispatch method of the Window you ask for the timeticks:
METHOD dispatch (oEvent) CLASS dtaTimer // DataWindow, called dtaTimer
IF oEvent:Message==WM_TIMER
Do something for alarm......
Show a DialogWindow, Play a sound etc....
ENDIF
If you give me some info about a condition you want to check I can write you
a sample.
Regards
Urs
<zodcomag@gmail.com> schrieb im Newsbeitrag
news:ee184ab7-1d62-4d82-916f-35c19e05b4e4@googlegroups.com...
> How can I set an alarm in windows from VO?
>
> Thanks
> Henry
[toc] | [prev] | [next] | [standalone]
| From | zodcomag@gmail.com |
|---|---|
| Date | 2017-02-20 08:33 -0800 |
| Message-ID | <5492d2be-1870-4d7a-a170-47b2725e75c5@googlegroups.com> |
| In reply to | #10172 |
Urs thanks I beleive that this alarm is based on the VO timer, so when the progarm will be closed, it will not start the alarm. Am I right? Is there a way I can insert data into the the data of Windows schedular? Henry
[toc] | [prev] | [next] | [standalone]
| From | D.J.W. van Kooten <vankooten@removethis.ic2.com> |
|---|---|
| Date | 2017-02-20 18:18 +0100 |
| Message-ID | <n39macl01l9tecba03krs06kn4kpihofn7@4ax.com> |
| In reply to | #10175 |
Replying on message of Mon, 20 Feb 2017 08:33:34 -0800 (PST) from zodcomag@gmail.com: Hello Henry, >I beleive that this alarm is based on the VO timer, >so when the progarm will be closed, it will not start the alarm. >Am I right? > >Is there a way I can insert data into the the data of Windows schedular? > I think there is, take a look at this link: https://www.tritac.com/developers-blog/programmatically-configure-server-tools-iis-task-scheduler-filezilla-server-firewall-with-c/ Apaprently there's a NuGet package which allows you to write code to access the Task Scheduler. There's a C# code sample for changing a directory of an action of a task. Dick
[toc] | [prev] | [next] | [standalone]
| From | "Urs Eggmann" <Urs.Eggmann@shinternet.ch> |
|---|---|
| Date | 2017-02-20 21:03 +0100 |
| Message-ID | <eh14riFgl0U1@mid.individual.net> |
| In reply to | #10175 |
Hi Henry, > I beleive that this alarm is based on the VO timer, > so when the progarm will be closed, it will not start the alarm. Correct. May be the post of Dick helps. regards Urs
[toc] | [prev] | [next] | [standalone]
| From | Franz Rachbauer <office@rachbauer.org> |
|---|---|
| Date | 2017-02-21 07:08 +0100 |
| Message-ID | <o8glgt$1itn$1@gioia.aioe.org> |
| In reply to | #10175 |
Make a small VO app, which runs unvisible in background, starts at windows start and handles the timer. Regards, Franz Am 20.02.2017 um 17:33 schrieb zodcomag@gmail.com: > Urs thanks > > I beleive that this alarm is based on the VO timer, > so when the progarm will be closed, it will not start the alarm. > Am I right? > > Is there a way I can insert data into the the data of Windows schedular? > > Henry >
[toc] | [prev] | [next] | [standalone]
| From | Willie Moore <williem@wmconsulting.com> |
|---|---|
| Date | 2017-02-21 09:34 -0600 |
| Message-ID | <467089544.509383920.844642.williem-wmconsulting.com@news.aioe.org> |
| In reply to | #10175 |
Henry, In the vo samples, there is a folder called winsdk. There is a folder below called service. It has an aef called voservice that lets you schedule programs via an ini file. It might give you some ideas. Regards, Willie Grafx Development Team
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2017-02-21 08:07 -0800 |
| Message-ID | <5d1b0a7a-60d8-4d24-a8e4-3d2a5682456e@googlegroups.com> |
| In reply to | #10172 |
Older posted code.. to program Windows scheduler.. might help you.
Phil McGuinness
---------------
// Add a schedule task
sTime :=Left(Time(),8)
nHours :=Val(SubStr(sTime,1,2))
nMinutes:=Val(SubStr(sTime,4,2))
DO CASE
CASE Empty(sUser)
DebOut32(String2Psz("No UserName for creating SCHTASKS task!"))
CASE Empty(sPass)
DebOut32(String2Psz("No Password for creating SCHTASKS task!"))
OTHERWISE
DebOut32(String2Psz("Create Windows Task Planner..."))
// Set the time and path parameters
sTime:=MC_StringMerge2("%1:%2:00",StrZero(nHours,2,0),StrZero(nMinutes,2,0))
// Like string.Format
sPath:=Upper(Universe:Filespec:Drivepath) // Set the path of the program
to be executed
sPath:=StrTran(sPath,"PROGRAM FILES","PROGRA~1") // Strip spaces (or use
quotes)
// Add the task to the scheduler
TaskAdd(sUser,sPass,DWSCHTASKS_SC_ONCE,sTime,"UpdateCashIt-"+sTime,sPath+"Bake-itUpdate.exe
"+sPar)
END
// Function to add a task to the Windows Scheduler
FUNCTION TaskAdd(cUserName AS STRING,cUserPassword AS STRING,dwSchema AS
DWORD,sExtraScheme AS STRING,cTaskName AS STRING,cCommandLine AS STRING) AS
LOGIC PASCAL
LOCAL cParameters AS STRING
LOCAL cSchema AS STRING
LOCAL lRetValue AS LOGIC
// Parameters
cParameters:="/Create"
cParameters+=" /RU "+cUserName
cParameters+=" /RP "+cUserPassword
DO CASE
CASE dwSchema==DWSCHTASKS_SC_DAILY
cSchema:="Dagelijks"
// ST = "HH:MM:SS"
cParameters+=" /SC "+cSchema
cParameters+=" /ST "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_MINUTE
cSchema:="Minuut"
// MO = 1 - 1439
cParameters+=" /SC "+cSchema
cParameters+=" /MO "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_EVERY_HOUR
cSchema:="Elk uur"
// MO = 1 - 23
cParameters+=" /SC "+cSchema
cParameters+=" /MO "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_WEEKLY
cSchema:="Wekelijks"
// MO = 1 - 52
// MLV Missing /ST!
cParameters+=" /SC "+cSchema
cParameters+=" /MO "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_MONTHLY
cSchema:="Maandelijks" // Daily
// /MO = 1 - 12
// /D = Day
// /ST = Time
// /M = Month
cParameters+=" /SC "+cSchema
cParameters+=" /MO "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_ONCE
cSchema:='"Eén keer"'
// ST = "HH:MM:SS"
cParameters+=" /SC "+cSchema
cParameters+=" /ST "+sExtraScheme
CASE dwSchema==DWSCHTASKS_SC_STARTUP
cSchema:='"Bij opstarten"'
// No options
cParameters+=" /SC "+cSchema
CASE dwSchema==DWSCHTASKS_SC_LOGIN
cSchema:='"Bij aanmelden"'
// No options
cParameters+=" /SC "+cSchema
CASE dwSchema==DWSCHTASKS_SC_NOT_ACTIVE
cSchema:='"BIJ NIET-ACTIEF"'
// No options
cParameters:=cParameters + " /SC "+cSchema
OTHERWISE
// Other constants have to be defined.
// NOTE: The dutch version OF SCHTASKS.EXE only recognizes dutch
words here!
// Maybe other localized versions only accepts words on the
respective language!?
ENDCASE
// Clean he commandline
cTaskName:=StrTran(cTaskName,">","")
cTaskName:=StrTran(cTaskName,"<","")
cTaskName:=StrTran(cTaskName,",","")
cTaskName:=StrTran(cTaskName,":","")
cTaskName:=StrTran(cTaskName,";","")
cTaskName:=StrTran(cTaskName,"|","")
cTaskName:=StrTran(cTaskName,"/","")
cTaskName:=StrTran(cTaskName,"\","")
// Task
cParameters+=" /TN "+cTaskName
cParameters+=' /TR "'+cCommandLine+'"'
// Sample : cParameters:="/Create /RU Domain\User /RP Pass /SC Dagelijks
/ST 18:00:00 /TN Programatically_created_task /TR
c:\windows\system32\notepad.exe"
lRetValue:=MC_RunSafe("","SCHTASKS.EXE",cParameters)
RETURN lRetValue
// RunSafe to execute Windows apps / terminal
Function MC_RunSafe(sPath,sFile,sOptions)
LOCAL SEInfo AS _WinShellExecuteInfo
LOCAL hProc AS PTR
LOCAL lpExitCode AS DWORD
LOCAL lRunning AS LOGIC
LOCAL lRetVal AS LOGIC
SEInfo :=MemAlloc(_SIZEOF(_WINShellExecuteInfo))
SEInfo.cbSize :=_SIZEOF(_WINShellExecuteInfo)
SEInfo.fMask :=SEE_MASK_NOCLOSEPROCESS + SEE_MASK_FLAG_NO_UI
SEInfo.Hwnd :=NULL_PTR
SEInfo.lpVerb :=PSZ(_CAST,"open")
SEInfo.lpFile :=PSZ(_CAST, sFile)
SEInfo.lpParameters :=PSZ(_CAST, sOptions)
SEInfo.lpDirectory :=String2Psz(sPath)
SEInfo.nShow :=SW_HIDE
SEInfo.hInstApp :=NULL_PTR
SEInfo.lpClass :=NULL_PSZ
IF ShellExecuteEx(SEInfo) // File executed correctly
hProc:=SEInfo.hProcess
GetExitCodeProcess(hProc,@lpExitCode)
lRunning:=(lpExitCode=STILL_ACTIVE)
DO WHILE lRunning // Wait until finishes
GetExitCodeProcess( hProc, @lpExitCode )
lRunning:=(lpExitCode=STILL_ACTIVE)
Sleep(1000)
ENDDO
CloseHandle(SEInfo.hProcess)
MemFree(SEInfo)
lRetVal:=TRUE
// File was executed and the execution finished
ELSE
// An error occured (use GetLastError() to see what happened)
MemFree(SEInfo)
lRetVal:=FALSE
ENDIF
RETURN lRetVal
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web