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.

Simple Shell UDFs


; Winbatch: Shell.Application UDF's
;           for when you might not want to link
;           in an Extender to perform a simple task.
;
; Stan Littlefield, September 28, 2006
;/////////////////////////////////////////////////////////////////

;uploading a file to a web folder w/progress meter
#DefineFunction ShellUpload(file,url,folder,flags)
oShell = CreateObject("Shell.Application")
oFolder = oShell.NameSpace(url)
isFolder=0
ForEach i In oFolder.Items
   If i.Name==folder
      isFolder=1
      oFolder = oShell.NameSpace(StrCat(url,"/",folder))
      Break
   EndIf
Next
If isFolder
   ret = oFolder.CopyHere(file,flags)
Else
   Display(2,"Cannot Upload file","Destination Folder %folder% Not Found")
EndIf
TimeDelay(3)
oFolder = 0
oShell = 0
Return(1)
#EndFunction

; quick way to determine if a service is running
#DefineFunction SvcRunning(svc)
oShell = CreateObject("Shell.Application")
ret = oShell.IsServiceRunning(svc)
oShell=0
Return(ret)
#EndFunction

;sample call to shell for ftp upload
;file = StrCat(dirscript(),"myfile.xls")
;If FileExist(file)
   ;format for url
;   url= "ftp://username:pw@ftp.myFTPSite.com"
;   folder="Downloads"
;   flags = 0
;   ShellUpload(file,url,folder,flags)
;Endif
;Exit


;sample call for svcrunning
;svc="LogMeIn"
;If SvcRunning(svc)
;   Display(1,"Service Running",svc)
;Else
;   Display(1,"Service NOT Running",svc)
;Endif
;Exit

;////////////////////////////////////////////////////////////

Article ID:   W17237
File Created: 2007:07:03:14:28:56
Last Updated: 2007:07:03:14:28:56