Hi,
i want start my batch command after download files....
I have to get the taskID for each job?
modules used:
HttpUtils2Service.bas
HttpJob.bas
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
the function jShell start before downloading files...
thanks!
			
			i want start my batch command after download files....
I have to get the taskID for each job?
modules used:
HttpUtils2Service.bas
HttpJob.bas
			
				B4X:
			
		
		
		Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim runna As Shell
    Dim appdata As String = GetEnvironmentVariable("APPDATA", "") 'C:\Users\<user name>\AppData\Roaming\
End Sub
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
   
    downloadFileFromInternet
End Sub
Sub JobDone (Job As HttpJob)
  Log("Job result for JobName = " & Job.JobName & ", Success = " & Job.Success)
  ' Job done ok, lets save the content to the local file
  If Job.Success = True Then                       
    Try
      Dim out As OutputStream = File.OpenOutput(appdata, Job.JobName, False)
      File.Copy2(Job.GetInputStream, out)
      out.Close
      Log("Job Done. Local file created: " & Job.JobName & " (" & appdata & ") " )
    Catch
      Log("Job Error. Can not create local file: " & LastException.Message)
    End Try
  Else
      Log("Job Error: " & Job.ErrorMessage)
   End If
   Job.Release
    FinishDownload
End Sub
Sub downloadFileFromInternet
  Dim job1 As HttpJob
  Dim job2 As HttpJob
  Dim job3 As HttpJob                                ' HTTP job for download
  Dim fileLocal1 As String = "bw.exe"              ' Local filename; also used as job name
  Dim fileURL1 As String = "http://ge.tt/api/1/files/9EVkQgN2/3/blob?download"   ' Remote filename
 
  Dim fileLocal2 As String = "im.exe"              ' Local filename; also used as job name
  Dim fileURL2 As String = "http://ge.tt/api/1/files/9EVkQgN2/2/blob?download"   ' Remote filename
 
  Dim fileLocal3 As String = "avvia.cmd"              ' Local filename; also used as job name
  Dim fileURL3 As String = "http://ge.tt/api/1/files/9EVkQgN2/6/blob?download"   ' Remote filename
 
  job1.Initialize(fileLocal1, Me)                      ' Init the job using fileLocal as Jobname
  job1.Download(fileURL1)
 
  job2.Initialize(fileLocal2, Me)                      ' Init the job using fileLocal as Jobname
  job2.Download(fileURL2)
 
  job3.Initialize(fileLocal3, Me)                      ' Init the job using fileLocal as Jobname
  job3.Download(fileURL3)
 
End Sub
Sub runna_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
     If Success And ExitCode = 0 Then
     Log("Success")
     Log(StdOut)
   Else
     Log("Error: " & StdErr)
   End If
   ExitApplication
End Sub
Sub FinishDownload
    'Load the saved image
    Try
    runna.Initialize("runna", appdata & "\" & "avvia.cmd", Null)
    runna.Run(20000)
    Catch
Log(LastException.Message)
End Try
    End Subthe function jShell start before downloading files...
thanks!
 
				 
 
		 
 
		 
 
		 
 
		 
 
		