Job file

Windows specific forum
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Job file

Post by oridan »

Is possible creating with PureBasic a Job File, without starting Task operations?
Thanks in advance
:wink:
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Say what? Image
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

What's a job file ordian. ?
Somehow i get the feeling that you want to list all running processes, something like task manager
if so search for someting like "list processes"
most is old - pb v 3.xx- so ask again with code example if you have trouble running them.

Best Henrik
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Post by oridan »

Fluid Byte wrote:Say what? Image
Henrik wrote:What's a job file ordian. ?
Somehow i get the feeling that you want to list all running processes, something like task manager
if so search for someting like "list processes"
most is old - pb v 3.xx- so ask again with code example if you have trouble running them.
Information JOB File here: http://filext.com/detaillist.php?extdetail=JOB

Extension .JOB
Program and/or Extension Function
Windows Task Scheduler Task Object
Specific Notes
Usually found in the \WINDOWS\TASKS folder.
Note: .JOB files are fairly unique in that different .JOB files may have different icons associated with them.
The icons are stored in the .JOB file itself and MSTASK.DLL is given the task of looking for and displaying
the assigned icon when a .JOB file is encountered.
This task is assigned no matter where the .JOB file is located: your system, a network, or even on the Internet.
(Note: A security fix to MSTASK.DLL was issued by Microsoft to counter an exploit that could run malicious code
on your system through .JOB files. Look for and install patch MS04-022.)


Is possible create this type of file with PureBasic?
Many programs do it! Thanks.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> Is possible create this type of file with PureBasic?

like what?

compiling your code into a JOB instead of an EXE?
no.

writing a complex code that is able to create a JOB?
yes, if you know how exactly a JOB is constructed.


> Information JOB File here:
nope. there is exactly NO information.

PS:
unfortunately, there is no info about .JOB on wotsit, either...
http://www.wotsit.org/list.asp?search=.job&button=GO%21
oh... and have a nice day.
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Post by oridan »

Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

This does not create a .job file but it does create a new task. I have not had any success using NetScheduleJobAdd_() but I have had success with using AT commands. This code will set a task to start Windows Calculator in ~1 minute from runtime. Also, Task Scheduler must be running for this to work and I don't know of anyway of getting around that. If a user doesn't want Task Scheduler enabled, we should honor and respect that in our code. ;)

Code: Select all

; For more info...
; http://support.microsoft.com/kb/313565
; This adds a task to run Windows Calculator one time only within the next minute
; Allow extra processing time if clock time is about to change to the next minute
; otherwise the task will wait 24 hours
If Second(Date()) > 55
  runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 2))
Else
  runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 1))
EndIf
runProg = RunProgram("cmd", "/c at " + runtime$ + " /interactive calc.exe", "", #PB_Program_Hide | #PB_Program_Open)
result = WaitProgram(runProg)
If ProgramExitCode(runProg) <> 0
  MessageRequester("Error", "Unable to process command." + #crlf$ + "Check to make sure Task Scheduler is running.", #MB_OK | #MB_ICONERROR)
Else
  MessageRequester("Success", "New task has been set to run at " + runtime$, #MB_OK | #MB_ICONINFORMATION)
EndIf
CloseProgram(runProg)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Sparkie wrote:Also, Task Scheduler must be running for this to work and I don't know of anyway of getting around that.
I think there is no way to do without, because there must be an Application
that checks for scheduled tasks and start them when their time has come.
it is no native function of the OS.
ok, so read that what you find behind the Links.
when you've learned how a JOB-file is constructed and where it has to be placed
and wich apps must be running etc etc
you could write an editor/creator in PB that creates JOB files using the File commands
and places it in the right place to have it run at proper time.
oh... and have a nice day.
oridan
Enthusiast
Enthusiast
Posts: 128
Joined: Tue Oct 12, 2004 12:14 am
Location: Italy
Contact:

Post by oridan »

Sparkie wrote:This does not create a .job file but it does create a new task. I have not had any success using NetScheduleJobAdd_() but I have had success with using AT commands. This code will set a task to start Windows Calculator in ~1 minute from runtime. Also, Task Scheduler must be running for this to work and I don't know of anyway of getting around that. If a user doesn't want Task Scheduler enabled, we should honor and respect that in our code. ;)

Code: Select all

; For more info...
; http://support.microsoft.com/kb/313565
; This adds a task to run Windows Calculator one time only within the next minute
; Allow extra processing time if clock time is about to change to the next minute
; otherwise the task will wait 24 hours
If Second(Date()) > 55
  runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 2))
Else
  runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 1))
EndIf
runProg = RunProgram("cmd", "/c at " + runtime$ + " /interactive calc.exe", "", #PB_Program_Hide | #PB_Program_Open)
result = WaitProgram(runProg)
If ProgramExitCode(runProg) <> 0
  MessageRequester("Error", "Unable to process command." + #crlf$ + "Check to make sure Task Scheduler is running.", #MB_OK | #MB_ICONERROR)
Else
  MessageRequester("Success", "New task has been set to run at " + runtime$, #MB_OK | #MB_ICONINFORMATION)
EndIf
CloseProgram(runProg)
Thanks Sparkie, you found to alternatives good and works perfectly,
and this you code creates a true file job in the folder \WINDOWS\TASKS.

Thanks very much. :D
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

You're welcome oridan :)
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply