I'm trying to create an application that will "wash" a number of files containing emailadresses so each user only gets a certain amout of newsletters per week.
For instance we send one general newsletter and a number of specialized newsletters per week. If your profile matches all the newsletters we still only want you to receive two newsletters per week. The application should look at the emailadress and the priority of the file to determine which two newsletters the emailadress should be used in.
The solution I have thought of means that the user would upload any number of files (and set a priority for each file). ( I would prefer it if there is a way that does not mean that the files needs to be loaded in the script and instead are uploaded by the end-user).
We have managed to create a VB script that allows the end user to select and upload files using the following code:
Sub LoadFile 'Create and initialize variables Dim oFSO, inputFile, oFile, row Dim emailAddress, emailHash, tmp Dim emailListVar, emailHashVar Dim selection Set selection = ActiveDocument.getField("FilNr").GetSelectedValues(1) emailListVar = "Email_list_" & Selection.Item(0).Text emailHashVar = "Email_hash_" & Selection.Item(0).Text emailAddress = "" emailHash = "" 'Get file to read inputFile = GetFileOpenDlg() 'Read selected file Set oFSO = CreateObject("Scripting.FileSystemObject") If oFSO.FileExists(inputFile) Then Set oFile = oFSO.OpenTextFile(inputFile, 1) Do While Not oFile.AtEndOfStream row = oFile.ReadLine 'If row is not empty If Trim(row) <> "" Then tmp = Split(row, VbTab) 'If neither field is empty, add to variables If (Len(Trim(tmp(0))) > 0 And Len(Trim(tmp(1))) > 0) Then emailAddress = emailAddress & Trim(tmp(0)) & VbCrLf emailHash = emailHash & Trim(tmp(1)) & VbCrLf End If End If Loop oFile.Close 'Set QV-variables with the file contents ActiveDocument.GetVariable(emailListVar).SetContent emailAddress, true ActiveDocument.GetVariable(emailHashVar).SetContent emailHash, true MsgBox(emailAddress) MsgBox(emailHash) End If End Sub
When I look in my application (for instance create a listbox with the following expression =Email_list_1, then I can see that the emailadresses are there.
My problem is that I can not find a way to work with the data. If the data was loaded via the script I would be able to create logic that would give me which emailadresses should go in which files.
Anyone know how to get the variable data into i field in qv?