| | | 
Supreme Being
       
Group: Forum Members Last Login: 6/21/2007 3:27:09 PM Posts: 95, Visits: 748 |
| | I have not, but I will double-check. The problem is the program works fine when I double click. When I try to execute from command-line, it doesn't. |
| | | | 
Supreme Being

Group: Moderators Last Login: 12/21/2008 11:16:31 PM Posts: 837, Visits: 1,901 |
| So simply passing the IMPORT.EXE parameters from a comand line does not work? Can you please post a reply with your full command line?
Bryan
Point Product Manager |
| | | | 
Supreme Being
       
Group: Forum Members Last Login: 6/21/2007 3:27:09 PM Posts: 95, Visits: 748 |
| | Finally, its working. I think it was due to three things. 1. I had a relative path for the import.exe file and ImportDefinition. Absolute paths are a must. 2. Wscript.Echo - I was trying to debug and view the command about to be executed. When I double click, a pop-up box appears. From command line, no pop-up box visible, but the program is still waiting for input. I commented out the debugging code. 3. Way too many open windows. Am I violating anything by posting my code? |
| | | | 
Supreme Being
       
Group: Forum Members Last Login: 6/21/2007 3:27:09 PM Posts: 95, Visits: 748 |
| | ==== ImportFiles.vbs ========== Option Explicit On Error Resume Next Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const ImportDefinition = "D:\ScheduledTasks\WebAppImport\Final.imp" 'Import Definition Created in Point Const ImportLocation = "J:\PROSPECT" ' Prospect Area Const ImportFile = "D:\ScheduledTasks\WebAppImport\ImportCode\Import.exe" ' ImportCode contains all dependent DLLs
Dim oFiles, FileName, return Dim WshShell, WSHNetwork Dim fso, f, fc, fsoWriteFile, ImportCommand Set WshShell = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set WSHNetwork = WScript.CreateObject("WScript.Network") WSHNetwork.RemoveNetworkDrive "J:", True, True WSHNetwork.RemoveNetworkDrive "K:", True, True
WSHNetwork.MapNetworkDrive "J:", "\\server\destinationShare" WSHNetwork.MapNetworkDrive "K:", "\\server\SourceShare" set f = fso.GetFolder("K:\") set fc = f.Files ' Open Log file for appending results set fsoWriteFile = fso.OpenTextFile("k:\WebImportLog.log",ForAppending, true) 'Parse files in target directory for each FileName in fc if instr(3,Filename, "app",1) then 'app prefix will appear on all web originated files ImportCommand = ImportFile & " " & FileName & " " &_ ImportDefinition & " " & ImportLocation fsoWriteFile.WriteLine "======================================================" _& " ==================================" fsoWriteFile.WriteLine ( "-- " & FileName & " == Read " & Date & " @ " & Time & " ---" ) fsoWriteFile.WriteLine ImportCommand 'The Beef return = WshShell.Run(ImportCommand,1,true) fsoWriteFile.WriteLine( "---- Processed with Exit Code = " & return) fsoWriteFile.WriteLine ("---- " & FileName & " Moved to Archive Folder") fso.MoveFile FileName, "K:\Archive\" fsoWriteFile.WriteLine "=======================================================" _& "=================================" fsoWriteFile.WriteLine else end if Next 'Remove Network Drives WSHNetwork.RemoveNetworkDrive "J:", True, True WSHNetwork.RemoveNetworkDrive "K:", True, True
'Cleanup fsoWriteFile.Close Set WSHNetwork = nothing Set fsoWriteFile = nothing Set fso = nothing ========================
|
| | | | Forum Newbie
       
Group: Forum Members Last Login: 11/13/2006 5:31:37 PM Posts: 9, Visits: 49 |
| Orion, If you ever anticipate file names with spaces in them, you should wrap quotes around your command line arguments.
USE: the Chr(34) literal quote
ImportCommand = ImportFile & " " & Chr(34) & FileName & Chr(34) & " " &_ Chr(34) & ImportDefinition & Chr(34) & " " & Chr(34) & ImportLocation & Chr(34) |
| |
|
|