Same file path and files in LabVIEW - labview

I saved the data in txt file. Everything is ok. Now, I want to show the data on the chart then that data send by email.
First, I select the txt file from the dialog and then show it on the chart or graph which is ok till here. Then, I want to attach that file automatically and after 5 sec sends it to a specific email. my problem is that I don't want to create a control for attach to choose the txt file, I want to select once the file , then read, then that file email.
Normally, I must select once to read and another time again to select that file (2 times) but I want to select one time the txt file then read and after 5 sec that file attaches and email. I cannot connect attach file wire (RED Wire) to the file dialog because the type of attach is 1D array file path and the type of file dialog is path, I don't know what should I do.
Thanks for helping me.

Use Build Array function to convert your single path (which goes from path select dialog) to 1D array of paths.

Related

taking an excel file as a input data from user in julia

I want to ask from users to load an excel file as an input data. this process must be done by opening a browsing window to select excel file.
what can I do?
You can use open_dialog_native from Gtk.jl.
julia> open_dialog_native("Choose the input Excel file", GtkNullContainer(), ("*.xlsx",))
"/path/to/myfile.xlsx"
It opens the file chooser interface appropriate to the user's OS, and once the file is chosen, returns the chosen file's full path as a string.
The ("*.xlsx",) is a tuple that constrains what type of files are shown by default in the file chooser. (The GtkNullContainer() argument just specifies that you're not running this as part of an existing GTK app.)
Documentation here

VBA Excel Reading text file from certain line number onward

say we have an external program, that writes a text file during a long calculation.
Now, I need to read that file in order to check the status of calculation (residuals values, stop on error etc).
The file has size of up to 1Mb. Since the program only adds new information to the end of the file, I dont want to reopen it and reread from the very beginning each time.
Is there a way to start reading the file from a specific line number (where I stopped last time)?
What happens to the file when it is opened in Excel for reading, and after that it is changed by the external program? EoF position shifts forward?
You can use the statement Seek [#]filenumber, position to move to a specific byte in a opened file. Just save the position in the file where you stopped with the function Seek( filenumber ) or with LOF( filennumber ) if you reached the EOF( filenumber ).

Creating a file with name given in code in LiveCode

I'm trying to build a program that gets users name at first. This user names are kept in a text file. After user logins, according to the user's name, I want user to be lead his/her specific informations. I figured out that I can only do it with a file that is created when he sign up for an account which I direct him with my sign up button in Livecode. While he/she create his account I want to create a specific file for his/her. Can you help me with it please?
PS: I don't want to do it with a database right now. I just want to learn how to create a file without a specific name like
put specialFolderPath("documents")&"/userLoginCridentials.txt" into tFile put URL("file:"&tFile) into myFile
Instead of this "userCridentials.txt" I want something user can create with his own name :)
Having a little problem to understand your question. Are you targeting mobile or desktop? Are you having problem saving or reading the data?
If saving is you problem
On desktop you can use:
ask file "Save file as:"
then you get the filename back in it so you can use:
if it is not empty then
# We have a complete file path in 'it'
put it into tFile
put tData into url ("file:" & tFile)
end if
If you targeting mobile and would like to save into the specialFolderPath("Documents")you can get the filename from a field and then save to that file. E.g. if you have a field named 'fileName' you can use something like:
put tData into url("file:" & specialFolderPath("Documents") & "/" & field "fileName"
Of course you should do some error checking to ensure that a user don't overwrite existing files without at least asking for permission, etc.
You can of course use a variable instead of a field...
If reading data is your problem
On desktop you can use:
answer file "Open File:"
Same as above but you now read data instead:
if it is not empty then
# We have a complete file path in 'it'
put it into tFile
put url ("file:" & tFile) into tData
end if
on mobile you probably would like to present a list with the user-created files. In LiveCode you can list all files in the defaultFolder with the files. But you must set the defaultFolder to the folder you want to list.
set the defaultFolder to specialFolderPath("Documents")
put the files into tFiles
Now tFiles contains every file in that folder and you can filter it, display it in a list etc. E.g:
filter tFiles with "*.txt"
put tFiles into
If your problem is how to remember the "current" file name
Whenever you restart your app every variable is reset. So everything you want to remember between runs needs to be saved before your app quits. And for that you need a predefined filename. SO then your procedure will be:
Read in the predefined file.
Grab the file name from within that file
Read the file
If your problem is something else
Sorry, then I misunderstood your question...

Append multiple PDF files

I have about 600 PDF files that I want to add a single disclaimer page to the beginning of each of them. So, I need to find a way to merge two PDF documents where one file is always the same and and comes first and the second file is changing.
Please let me know how I can do this.
Thanks!
I found this:
http://gotofritz.net/blog/howto/joining-pdf-files-in-os-x-from-the-command-line/
So you could do something like this in a shell script:
#!/bin/bash
page1="disclaimer.pdf"
for f in {a.pdf b.pdf c.pdf}; do
"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o "$f" "$page1" "$f"
done
You can wrap this in an Applescript or automator workflow it you like.
Combine an unknown PDF with a known PDF
Automator can do this. You would save it as an application, so that you can drop the second file onto it. Your steps would be something like:
Get Specified Finder Items: Add the known PDF document here, the one that is “always the same and comes first”.
Combine PDF Pages
Move Finder Items: To: Combined Files. This will create a randomly-named file in the folder “Combined Files” which you will need to create.
If this Automator workflow is saved as an application, you can drop your second, "changing" file onto the application icon. The workflow will combine the two, putting the named file first.
Loop this workflow for each dropped file
In order to do this on multiple files at once, you will need to create a second workflow that loops through each dropped file and calls the above workflow. This second workflow is also created as an application. It has only one step:
Run Workflow: choose the workflow created in the previous step, and process items in batches of 1 at a time using 1 workflow.
Give the files a more usable name
That’s the basics. The obvious drawback is that all of the files have random names. That can be fixed by grabbing the original filename into a variable, and saving the new, combined document using that name in your new folder.
First, add four new steps to the top of the first workflow, in front of “Get Specified Finder Items”:
Run AppleScript
Set Value of Variable: name the variable filepath.
Run AppleScript
Set Value of Variable: name the variable filename.
Get Value of Variable: filepath
The first two steps save the full path to the dropped PDF. The second two steps get just the filename portion. The fifth new step pops the full path back into the workflow so that it can be combined with the known disclaimer.
Set the AppleScript in step 1 to:
on run {input, parameters}
return input
end run
Set the AppleScript in step 3 to:
on run {input, parameters}
tell application "Finder"
set filename to name of file input
end tell
end run
Then, add a step at the end to rename the file. After Move Finder Items add *Rename Finder Items. Choose “Name Single Item”, “Full name to” and then drag the variable filename up to the text box.

VB.NET: How to programatically create a text file in SSIS!

I would like to create a text file with some data i am manipulating in a script component and write it to a text file. i know how to write it to an existing text file, but what i would like to do is create the text file programmatically so i can name it textfile(TodaysDate).txt
How can i do this??
You can call File.CreateText(someString).
This method returns a StreamWriter which can be used to write to the file.
Remember to close the StreamWriter usinga using statement.
If you start with a sample of the text file that you want stored somewhere, you can use a file system task to copy the sample file to the correct name (make sure you copy so that it's still there for tomorrow). Then use an expression to set the file location in the file connection manager.