rholbrook
Well-Known Member
- Location
- Kaysville, Ut
I need help with a script. I am not a programmer, I am an accountant that does middle to upper-end accounting systems. I am able to do a lot of customizations with my limited knowledge of programming but I have ran into an issue.My client scans every AP invoice and saves it to a directory on the server. Each directory is under the vendors number and name for example and then adds the vendor number and invoice number to the pdf. They do put the "-" in between them as well. I can call the vendor number, name and invoice number from the program. \\server\finance\abc123-ABC Company\abc123-34234242.pdfIs there anyone out there that can help me here? I have had success doing this but I have never had to add "-" to the path and as well as assign directories on the fly like this.Here is my script:vdim pathpath ="\\w2k3sv1\Data\Finance\Accounts Payable\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_VendorName$ & "\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_InvoiceNo$ & ".pdf"Set fs = CreateObject("Scripting.FileSystemObject")Set Shell = CreateObject("Wscript.shell")'iF File exists then open it otherwise popup msgbox with explination If Fs.FileExists(path) Then Shell.Run(Chr(34) & Path & chr(34))Else msgbox("AP Document was not found")End IfHere is my Error:MS Script Link Error InformationUser... W2K3SV2Date... 3/17/2010Time... 09:41:48OLE Error Number... 1032Description........ Invalid characterLanguage........... VBScriptScript Line........ 30Script Column...... 81Script Text........ path ="w2k3sv1DataFinanceAccounts Payable" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_VendorName$ & "" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_InvoiceNo$ & ".pdf" 1 : ' 2 : ' Sage MAS 200 system variables 3 : ' 4 : MAS_SCR_CMP = "UCI" 5 : MAS_SCR_USR = "pace" 6 : MAS_SCR_MOD = "A/P" 7 : MAS_SCR_DTE = "20100317" 8 : MAS_SCR_HWD = "E:\APPS\Sage Software\MAS 200\Version4\MAS90\home" 9 : MAS_SCR_LWD = "E:\APPS\Sage Software\MAS 200\Version4\MAS90\soa" 10 : MAS_SCR_LIB = "E:\APPS\Sage Software\MAS 200\Version4\MAS90\AP\AP_INVOICEHISTORY.M4L" 11 : MAS_SCR_PNL = "PAPHEADER" 12 : MAS_SCR_OBJ = "BT_LINK_1" 13 : MAS_SCR_MSG = "" 14 : MAS_SCR_PFM = "" 15 : MAS_SCR_CS = 1 16 : MAS_SCR_DBG = 0 17 : MAS_SCR_ERR = 0 18 : ' 19 : ' form variables passed in by Customizer 20 : ' 21 : AP_InvoiceHistory_bus_VendorName = "Kootenai Truck & Auto Repair" 22 : AP_InvoiceHistory_bus_InvoiceNo = "000021524" 23 : AP_InvoiceHistory_bus_VendorNo = "KOOTRU" 24 : ' 25 : ' language : VBScript 26 : ' file name : ..\cm\script\lnk012.txt 27 : ' script begin 28 : ' 29 : dim path 30 : path ="\\w2k3sv1\Data\Finance\Accounts Payable\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_VendorName$ & "\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_InvoiceNo$ & ".pdf" 31 : Set fs = CreateObject("Scripting.FileSystemObject") 32 : Set Shell = CreateObject("Wscript.shell") 33 : 'iF File exists then open it otherwise popup msgbox with explination 34 : If Fs.FileExists(path) Then 35 : Shell.Run(Chr(34) & Path & chr(34)) 36 : Else 37 : msgbox("AP Document was not found") 38 : End If 39 : ' 40 : ' script end 41 : 'dim pathpath ="\\w2k3sv1\Data\Finance\Accounts Payable\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_VendorName$ & "\" & AP_InvoiceHistory_bus_VendorNo$ & "-" & AP_InvoiceHistory_bus_InvoiceNo$ & ".pdf"Set fs = CreateObject("Scripting.FileSystemObject")Set Shell = CreateObject("Wscript.shell")'iF File exists then open it otherwise popup msgbox with explination If Fs.FileExists(path) Then Shell.Run(Chr(34) & Path & chr(34))Else msgbox("AP Document was not found")End If