Link to home
Start Free TrialLog in
Avatar of orlandorocks
orlandorocks

asked on

Converting vbs to Innosetup to create a scheduled task

I have a script that I would like to convert from vbs to Inno setup (like delphi)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create ("Notepad.exe", "********123000.000000-420", True , 1 OR 4 OR 16, , , JobID)
Wscript.Echo errJobCreated


to something like this...

var
  oWMI: Variant;
  oJob: Variant;
  ErrCode: Integer;
begin
  try
    begin
      oWMI := CreateOleObject('winmgmts:{impersonationlevel=impersonate}!\\abs1\root\cimv2');
      oJob := oWMI.Get('Win32_ScheduledJob');
      ErrCode := oJob.Create('Notepad.exe', '********123000.000000-420', True , 1 OR 4 OR 16, , , JobID);
    end;
  except;
  finally;

I get various syntax errors etc

This code will be compiled by the Inno setup compiler.  www.innosetup.com
ASKER CERTIFIED SOLUTION
Avatar of Kavar
Kavar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kavar
Kavar

Do you still need help with this?