Best text file to import for Motion Scroll?
Hi,
I will be getting a copy of the credits to add to the end of a play.
What format should I ask for the text to be in? What works best in Motion 4? (RTF, PDF, etc)
Thanks.
Watch this tutorial from Mark Spencer. It'll answer all your questions.
[MacBreak|http://pixelcorps.cachefly.net/mbks057_540ph264.mov]
Andy
Similar Messages
-
Reading in a text file to GUI for later analysis
Good Morning any and everyone,
I'm trying to get a piece of code working to read in a text file and it isn't working very well. The code has been seriously crunched together from a multitude of sources so I suspect that the error has occurred from there.
The errors that are occurring are "Can't Find Symbol" errors. Only 2 of them though which is a lot less than I had earlier. Now I'm just banging my head against the wall.
Has anyone got any suggestions as to where I'm going wrong? Anything greatly appreciated.
(PS> Please be gentle, I'm still a newbie)
Thanks.
import java.util.*; // required for List and ArrayList
import java.io.*; // required for handling and IOExceptions
import javax.swing.*;
public class textAnalyser extends JFrame // implements ActionListener
// the attributes
// declare a TextArea
private JTextArea viewArea = new JTextArea(10,55);
// declare the menu components
private JMenuBar bar = new JMenuBar();
private JMenu fileMenu = new JMenu("File");
private JMenu quitMenu = new JMenu("Quit");
private JMenuItem selectChoice = new JMenuItem("Select");
private JMenuItem runChoice = new JMenuItem("Run");
private JMenuItem reallyQuitChoice = new JMenuItem("Really quit");
private JMenuItem cancelChoice = new JMenuItem("Cancel");
// declare an attribute to hold the chosen file
private File chosenFile;
// the constructor
public textAnalyser()
setTitle("Text Analyser"); // set title of the frame
add(viewArea); // add the text area
// add the menus to the menu bar
bar.add(fileMenu);
bar.add(quitMenu);
// add the menu items to the menus
fileMenu.add(selectChoice);
fileMenu.add(runChoice);
quitMenu.add(reallyQuitChoice);
quitMenu.add(cancelChoice);
// add the menu bar to the frame
setJMenuBar(bar);
// add the ActionListeners
// selectChoice.addActionListener(this);
// runChoice.addActionListener(this);
// reallyQuitChoice.addActionListener(this);
// cancelChoice.addActionListener(this);
// configure the frame
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setSize(450,200);
setVisible(true);
public void actionPerformed(ActionEvent e)
if(e.getSource() == displayContentsChoice)
try
final int MAX = 300;
FileReader textFile = new FileReader("textfile.txt");
BufferedReader textStream = new BufferedReader(textFile);
int ch; // holds integer value of character
char c; // holds character when type cast from integer
int counter = 0; //counts number of characters read
ch = textStream.read(); //reads the first character from the file
c = (char) ch; //type cast from integer to character
viewArea.append("\n");
/* continue through the file until either the end of the file or the maximum
number of characters allowed have been read*/
while(ch != -1 && counter <= MAX)
counter++; // increment the counter
viewArea.append("" + c); // display the character
ch = textStream.read(); // read the next character
c = (char) ch;
textStream.close();
viewArea.append("\n");
catch(IOException ioe)
if(chosenFile == null) // no file selected
viewArea.append("No file selected\n");
else
viewArea.append("There was a problem reading the file\n");
}A couple of points:
*You've commented out stuff that is needed, like the adding of actionlisteners, the implements actionlistener,...
*Your actionlistener is looking for a menu choice which doesn't exist "displayContentsChoice". Does this menu item need to be created?
*How much of this code have you yourself created? Do you understand its inner working?
*What is the purpose of this code? Is it for work? School? Homework?
Good luck!
/Pete -
How to save data from text file in databse for a transaction...
Hi Guys,
I have a text file which has some data related relevant to transaction VA01 separated by tabs.
Now instead of going in the transaction in VA01 and thne feeding the data manually, I would like this data
to get read automatically from the text file and get processed field by field for transaction VA01 and thne get saved.
How do I achieve this ? Do I have to use SHDB or some other method ?ahi tushar,
REPORT ZCALL_TRANS_TAB1 .
TABLES: LFA1,LFBK,lfb1.
*& internal table declaration
data: BEGIN OF it_vendor occurs 0,
LIFNR LIKE LFA1-LIFNR,
bukrs like lfb1-bukrs,
END OF it_vendor.
DATA: BEGIN OF IT_BANK occurs 0,
LIFNR LIKE LFA1-LIFNR,
BANKS LIKE LFBK-BANKS,
BANKL LIKE LFBK-BANKL,
BANKN LIKE LFBK-BANKN,
koinh like lfbk-koinh,
END OF IT_BANK.
data: it_bdcdata like bdcdata occurs 0 with header line.
data: it_messages like bdcmsgcoll occurs 0 with header line.
*selection screen.
selection-screen: begin of block b1 with frame.
parameters: p_file like rlgrap-filename default 'c:/vendor.txt'
obligatory.
parameters: p_file1 like rlgrap-filename default 'c:/xyz.txt'
obligatory.
selection-screen: end of block b1.
*at selection screen.
at selection-screen on value-request for p_file.
perform f4_help using p_file.
at selection-screen on value-request for p_file1.
perform f4_help1 using p_file1.
*start of selection
start-of-selection.
*******uploading file
perform upload_file using p_file P_FILE1.
******open session.
perform populate_data.
*& Form f4_help
text
-->P_P_FILE text
form f4_help using p_p_file.
data: l_file type ibipparms-path.
call function 'F4_FILENAME'
importing
file_name = l_file.
p_file = l_file.
endform. " f4_help
*& Form POPULATE_DATA
text
--> p1 text
<-- p2 text
form populate_data .
DATA: L_STRING TYPE STRing.
DATA: L_COUNTER(2) TYPE n.
loop at it_vendor.
perform bdc_dynpro using 'SAPMF02K' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-D0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR'
it_vendor-lifnr.
perform bdc_field using 'RF02K-BUKRS'
it_vendor-bukrs.
perform bdc_field using 'RF02K-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-bankn(03)'.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
******CALL TRANSACTION.
call transaction 'FK02' using it_bdcdata mode 'A'
messages into it_messages.
write:/ sy-subrc.
perform format_messages.
clear it_bdcdata.
refresh it_bdcdata.
endloop.
endform. " POPULATE_DATA
*& Form FORMAT_MESSAGES
text
--> p1 text
<-- p2 text
form format_messages .
data: l_msg(100).
loop at it_messages.
call function 'FORMAT_MESSAGE'
exporting
id = it_messages-msgid
lang = sy-langu
no = it_messages-msgnr
v1 = it_messages-msgv1
v2 = it_messages-msgv2
v3 = it_messages-msgv3
v4 = it_messages-msgv4
importing
msg = l_msg
exceptions
not_found = 1
others = 2
write:/ l_msg.
endloop.
endform. " FORMAT_MESSAGES
*& Form bdc_dynpro
text
-->P_0173 text
-->P_0174 text
form bdc_dynpro using value(p_program)
value(p_screen).
it_bdcdata-program = p_program.
it_bdcdata-dynpro = p_screen.
it_bdcdata-dynbegin = 'X'.
append it_bdcdata.
clear it_bdcdata.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0178 text
-->P_0179 text
form bdc_field using value(p_fnam)
value(p_fval).
it_bdcdata-fnam = p_fnam.
it_bdcdata-fval = p_fval.
append it_bdcdata.
clear it_bdcdata.
endform. " bdc_field
*& Form upload_file
text
-->P_P_FILE text
-->P_P_FILE1 text
form upload_file using p_p_file
p_p_file1.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_P_FILE
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = IT_VENDOR
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.
STOP.
ENDIF.
*******UPLOADING BANK DETAILS
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = P_P_FILE1
FILETYPE = 'DAT'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = IT_BANK
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE I000(ZZ) WITH 'UNABLE TO UPLOAD'.
STOP.
ENDIF.
endform. " upload_file
*& Form f4_help1
form f4_help1 using p_p_file1.
data:l_file1 type ibipparms-path.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = l_file1.
p_file1 = l_file1.
endform. " f4_help1 -
Upload time data text file in ztable for HR module
dear all SAP guru's
text file is like that
260807300001
270815480001
270812210002.
1st 4 char is date&month .
2nd 4 char is time.
3rd 4 char is employee no.
i want to upload this file in z table.
when i m uploading the time is not uploading correctly.my condition is like that
already 1 condition is in Z table after that when i upload 2nd entry that time what 1st time is time in and 2nd is time out.
coding as fallows . give any solution for that.
LOOP AT it_out.
CONCATENATE sy-datum0(4) it_out-text2(2) it_out-text+0(2) INTO itab1-val1.
CONCATENATE it_out-text+4(4) '00' INTO itab1-val2.
MOVE it_out-text+8(4) TO itab1-val3.
APPEND itab1.
CLEAR itab1.
ENDLOOP.
SELECT *
FROM ztimedata
INTO TABLE it_ztimedata.
DESCRIBE TABLE it_ztimedata LINES cnt.
LOOP AT it_out.
CLEAR cnt.
LOOP AT itab1.
itab1-date1 = itab1-val1.
itab1-timein = itab1-val2.
itab1-pernr = itab1-val3.
cnt = cnt + 1.
itab1-counter = cnt.
MODIFY itab1.
ENDLOOP.
ENDLOOP.
SORT itab1 BY pernr date1 timein.
DATA cnt1 TYPE i.
DATA p_date LIKE sy-datum.
SELECT SINGLE * FROM ztimedata
INTO CORRESPONDING FIELDS OF it_ztimedata.
LOOP AT itab1.
ztimedata-counter = itab1-counter.
ztimedata-date1 = itab1-val1.
ztimedata-pernr = itab1-val3.
ztimedata-shift = itab1-shift.
ztimedata-attendance = itab1-attendance.
CLEAR IT_ZTIMEDATA-TIMEIN.
IF ztimedata-timein IS INITIAL.
it_ztimedata-timein = itab1-val2.
ztimedata-timein = itab1-val2.
CLEAR it_ztimedata-timeout .
ELSEIF ztimedata-timein IS NOT INITIAL.
it_ztimedata-timeout = itab1-val2.
ztimedata-timeout = itab1-val2.
ENDIF.
append it_ztimedata.
MODIFY ztimedata from it_ztimedata.
COMMIT WORK.
ENDLOOP.
in that coding if any correction pls correct me.
Nikhil NarkhedeHi,
You just try like this..Move date field into one Variable Year field into one variable and
Time field into one variable..Then Pass this field to your screen fields.
Rgs,
Priya. -
What's the best Bluetooth file sharing app for iPhone
I'm trying to find a good BT file sharing app for an iPhone 5. I've noticed that the iPhone 5 won't even detect devices such as other phones or computers with BT but seems to have no issue with BT accessories such as satnav. My iPod touch has no problem detecting any BT device which seems odd.
So, is there a good BT file sharing app availble for an iPhone 5?You won't find any Bluetooth File Sharing app that will work with non-iOS devices. That is something iOS simply does not support.
-
Improving Speech Analysis with a Text File | Peachpit TV for Video | Adobe TV
Using a text file in key words to improve speech recognition abilities in Adobe Premiere Pro.
http://adobe.ly/x8ioyOWhen I try to upload a reference .txt file (UTF-8 encoded), I get this error: Reference script creation failed. The destination folder may be locked or you may not have permission to write to this location.
Please advise how to navigate this error. Thanks! -
All .m4v files only import for 1 second (PRE 9/Windows 7)
Hi,
I'm a new PRE 9 user and am experiencing a really significant problem with importing .m4v files: Every .m4v I select ends at the 1-second mark and there does not seem to be any way to make the program see past that 1-second mark in the source file. Other file formats I've tried seem just fine, but most of the source material I want to use is already in .m4v files and have to think that this is some kind of bug.
Does anyone know what's going on here--and, more importantly, how to fix the problem so I can access the entire content of the .m4v files I want to use in PRE 9?
Thanks a lot and take care,
AlanHi Hunt,
Thanks for the rapid reply (and the welcome too). I think most of the files came from Handbrake (importing DVD content) if memory serves. All these .m4v files play just fine in Windows Media Player, QuickTime Player, etc.
I opened the properties for the last .m4v I tried to use (this morning) in PrE and the properties are listed as follows....
Type: MPEG Movie
File Size: 566.6 MB
Image Size: 718 x 370
Pixel Depth: 32
Frame Rate: 90000.00
Source Audio Format: 48000 Hz - compressed - Stereo
Project Audio Format: 48000 Hz - 32 bit floating point - Stereo
Total Duration: 00;00;01;09
Average Data Rate: 425.3 MB/second
Pixel Aspect Ratio: 1.1847
MediaInfo documents the same (.m4v) files properties as....
General
Complete name : C:\Users\Alan\Videos\Advent\Advent performances\Advent at MARPROG (Franklin's shoot) DVD 1.m4v
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 567 MiB
Duration : 1h 6mn
Overall bit rate : 1 188 Kbps
Encoded date : UTC 2011-04-15 13:27:00
Tagged date : UTC 2011-04-15 13:43:34
Writing application : HandBrake 0.9.5 2011010300
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1h 6mn
Bit rate mode : Variable
Bit rate : 1 093 Kbps
Width : 718 pixels
Height : 370 pixels
Display aspect ratio : 2.25:1
Original display aspect ratio : 2.25:1
Frame rate mode : Variable
Frame rate : 29.970 fps
Minimum frame rate : 9.990 fps
Maximum frame rate : 29.980 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.137
Stream size : 521 MiB (92%)
Writing library : x264 core 112
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=2 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=0 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=29 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=3 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2011-04-15 13:27:00
Tagged date : UTC 2011-04-15 13:43:34
Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 1h 6mn
Bit rate mode : Variable
Bit rate : 91.0 Kbps
Maximum bit rate : 339 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 43.4 MiB (8%)
Encoded date : UTC 2011-04-15 13:27:00
Tagged date : UTC 2011-04-15 13:43:33
Text
ID : 3
Format : Apple text
Codec ID : text
Duration : 1h 6mn
Bit rate mode : Variable
Bit rate : 1 bps
Stream size : 327 Bytes (0%)
Encoded date : UTC 2011-04-15 13:27:00
Tagged date : UTC 2011-04-15 13:43:34
Also, new PrE project appear to default to: "NTSC-Hard Disk, Flash Memory Camcorders-Standard 48kHz" (which I'm assuming is the default, as I don't recall changing anything).
I hope this information helps. Any insights as to how to get past this problem (bug?) would be greatly appreciated.
Take care and thanks again for your help,
Alan -
I am on a PC with CS4 Adobe Premiere Pro using XP OS.
I have VIO POV 1 (helmet cam) footage that I need to edit within my CS4 project. The Footage is DIVX MPEG4 AVI and Premiere doesn't recognize the video. I need to figure out the best conversion to maintain the highest quality format that Premiere will recognize.
What is your best recommendation on how to convert (and what format to convert to to maintain the best quality) and can you recommend a good converter program? Free perhaps if I don't have to buy one.
I have spent days looking for a solution and reviewing posts but to no avail. I have tried MPEG Streamclip, Virtual Dub, Digital Media Converter, Prism and many selected others.
-MPEG Streamclip doesn't seem to recognize the DIVX files (even after the 3IVX codec installed)
-Digital Media Converter (free watermarked version) seems to work to produce the DV AVI files (type II) but the quality is pretty low so not really wanting to pay $50 to use the low quality conversion -does the converter program have much to do with the quality of the output? It also produces a MPEG2 that seems a little better quality than the DV AVI file it produces.
-Prism does convert to a high quality AVI file that does output a really high quality file that plays in Media Player (latest version) but not in Premiere Pro CS4. Prism also converts to a WMV (windows media vid) that I can use on PP but is not quite the quality of the above noted AVI. This may be my best option???? Or is it a bad idea to use a compressed codec as wmv to edit and eventually output for the complete PP movie?
http://www.nchsoftware.com/prism/index.html
Any insight is very much appreciated. I must get on with my editing project!!! Thanks,
Aaron.Jeff, thanks so much, but I'm still not quite there! Agreed, codec packs can be dangerous but apparently the DIVX one is OK!
So I downloaded the DIVX pack, and the VirtualDub did work and converted via VirtualDub to AVI,... then tried in PremierePro. Again no luck viewing... sound OK but the video freezes on the first frame or two. I can view those outputs in MediaPlayer or DIVX player though. So I tried rerunning the UT codec installer and the logarith but still can't view the outputs from VirtualDub in PP.
I tried (in VirtualDub) converting the previously converted AVI file I did in Prism converter and again, can see the output in PP (still minor artifacts here and there though).
?Maybe I should just be happy with a the DIVX converted to a .wmv file but I think I will be sacrificing quality on already pretty grainy footage that I'm inserting into a largely HD film project so kinda shotty?
Any more suggestions? The help is greatly appreciated!
Aaron. -
Best Image File Type & Size for Photo Books?
When you select your photos to be included in a Photo Book submission, is there a required file type and maximum size. Most of my images are presently Photoshop .psd files and TIFF files of substantial size -- around 2 to 4MB, that I will have to import into iPhoto '09. Thanks.
Interesting. Presently, all my image files are at 300 dpi.
Remember that DPI has no meaning for a digital file - digital files have only dots - the per inch part comes form the print size so until you select a print size you had only "d" - not "dpi" - that is a totally meaningless number
See +The Myth of DPI+ for more information
How exactly is print size determined in the photo books -- from your selection
Obviously from your selection - you place a photo into a frame and the frame size is the size
You may want to take the tutorial for more information - http://www.apple.com/findouthow/photos/#books
or, whatever size results from the image resolution.
remember that images have no inherent size - they are just dots (pixels)
Is the ideal resolution 300 dpi? Thanks.
any image that will print at 180dpi or above will give good results (and will not get a resolution warning)
LN -
- Sample File : Lead Import For Sales Force Automation
Hello All,
Please can any one share a sample file for lead import in sales force automation.I need to test with a sample file and confirm that everything is file.I have a sample file that am presently having issues with.
I will appreciate if anybody can help with the sampel file .
ThanksHello All,
Please can any one share a sample file for lead import in sales force automation.I need to test with a sample file and confirm that everything is file.I have a sample file that am presently having issues with.
I will appreciate if anybody can help with the sampel file .
Thanks -
I have an iMac using OSX 10.9.5. I am looking for a good text to speech app or software. I want one that hi-lilghts the words as it reads and with editing tools if possible.
I'm not sure whether they do Spanish, but you should contact them, their application works extremely well.
http://www.nuance.com/naturallyspeaking/products/default.asp -
Best practice metadata export/import for WebCenter portal
Hi
I'm using JDeveloper to build the WebCenter portal. When I let's say register a portlet producer along with my portal, the information about it is stored in the metadata. In case I want to move my portal from the integrated WLS which JDeveloper provides to another WebLogic server with WebCenter installation - steps which I need to do are:
1) Export the metadata from JDeveloper
2) Import metadata to my target Weblogic server
3) deploy the application
Am I missing something?
To export/import metadata from JDeveloper to another Weblogic (equipped with WebCenter) server I should use the WLST script, right?
ThanksA little correction: IAS Version is Oracle9i Application Server Release 1 version 1.0.2.2.2
-
Identifying text file names and importing on single Excel sheet
Hey!
Does anybody can help me with Excel VBA macro code in order to import data from text files into single Excel spread sheet? I want to create User Form where user can select start and end date of interest and macro code will import
bunch of text files depending on user demands...
My text files are named: 20130619004948DataLog.txt (meaning: yyyy mm dd hh mm ss). Text file contains recordings for each 15 seconds... It would be great to omit time tail (meaning that user can only specify date). Text files for one day of interest (I have
text files covering whole year):
20130619004948DataLog.txt
20130619014948DataLog.txt
20130619024948DataLog.txt
20130619034948DataLog.txt
20130619044948DataLog.txt
20130619054948DataLog.txt
20130619064948DataLog.txt
20130619074948DataLog.txt
20130619084948DataLog.txt
20130619094948DataLog.txt
20130619104948DataLog.txt
20130619114948DataLog.txt
20130619124948DataLog.txt
20130619134948DataLog.txt
20130619144948DataLog.txt
20130619154948DataLog.txt
20130619164948DataLog.txt
20130619174948DataLog.txt
20130619184948DataLog.txt
20130619194948DataLog.txt
20130619204948DataLog.txt
20130619214948DataLog.txt
20130619224948DataLog.txt
20130619234948DataLog.txt
Option Explicit
Sub SearchFiles()
Dim file As Variant
Dim x As Integer
Dim myWB As Workbook
Dim WB As Workbook
Dim newWS As Worksheet
Dim L As Long, t As Long, i As Long
Dim StartDateL As String
Dim EndDateL As String
Dim bool As Boolean
bool = False ' to check if other versions are present
StartDateL = Format(Calendar1, "yyyymmdd")
EndDateL = Format(Calendar2, "yyyymmdd")
' I am using Userform asking user to select the date and time range of interet,
' However, I want to use only the date to filter the files having the name with that particular date
file = Dir("c:\myfolder\") ' folder with all text files
' I need assistance with the following part:
'1) How to filter and select the files between StartDateL and EndDateL_
'(including files with that dates as well)?
While (file <> "")
If InStr(file, StartDateL) > 0 Then 'Not sure if the statements inside parenthesis is correct
bool = True
GoTo Line1:
End If
file = Dir
Wend
Line1:
If Not bool Then
file = "c:\myfolder\20130115033100DataLog.txt" 'Just for a test that the code works as intended
End If
'This part for the selected text files to be loaded on a single Excel Sheet.
Set myWB = ThisWorkbook
Set newWS = Sheets(1)
L = myWB.Sheets(1).Cells(Rows.Count, "A").End(xlUp).Row
t = 1
For x = 1 To UBound(file)
Workbooks.OpenText Filename:=file(x), DataType:=xlDelimited, Tab:=True, Semicolon:=True, Space:=False, Comma:=False
Set WB = ActiveWorkbook
WB.Sheets(1).UsedRange.Copy newWS.Cells(t, 2)
t = myWB.Sheets(1).Cells(Rows.Count, "B").End(xlUp).Row + 1
WB.Close False
Next
myWB.Sheets(1).Columns(1).Delete
Application.ScreenUpdating = False
Rows("1:1").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub- Make a new Excel file
- Open the VBA editor
- Add a Userform
- Place 2 text boxes and 1 command button on that form
- Paste all code below into the code module of the form
- Download this file:
https://dl.dropboxusercontent.com/u/35239054/FileSearch.cls
- In the VBA editor press CTRL-M and import that file
- Save the Excel file in the directory that contain your text files
- Run the form
You can format the columns of the sheet as you like, e.g. column E:H should be a number with 5 decimal places. The top row can contain some headings. My code did not affect the formatting or the headings.
Andreas.
Option Explicit
Private Sub UserForm_Initialize()
'Just a sample
Me.TextBox1.Value = FormatDateTime(Now, vbGeneralDate)
Me.TextBox2.Value = FormatDateTime(Now, vbShortDate)
End Sub
Private Sub CommandButton1_Click()
Dim StartDate As Date, EndDate As Date
Dim FS As New FileSearch
Dim R As Range
Dim ThisFile As Variant
Dim ThisDate As Date
Dim Data As Variant
Dim Count As Long
'Be sure we have 2 dates
If Not IsDate(Me.TextBox1.Value) Then
Me.TextBox1.SetFocus
MsgBox "No start date"
Exit Sub
End If
If Not IsDate(Me.TextBox2.Value) Then
Me.TextBox2.SetFocus
MsgBox "No end date"
Exit Sub
End If
'Convert to real dates
StartDate = CDate(Me.TextBox1.Value)
EndDate = CDate(Me.TextBox2.Value)
'Time part given?
If Fix(EndDate) = EndDate Then
'No include all files for this day
EndDate = EndDate + TimeSerial(23, 59, 59)
End If
'Correct order?
If StartDate > EndDate Then
ThisDate = EndDate
EndDate = StartDate
StartDate = ThisDate
End If
With FS
'Same path as our file
.LookIn = ThisWorkbook.Path
.FileName = "*DataLog.txt"
'Search all files sort by file name
If .Execute(msoSortByFileName, msoSortOrderAscending) = 0 Then
MsgBox "No data files found in " & .LookIn
Exit Sub
End If
'Clear previous data
Set R = Range("A2").CurrentRegion
If R.Row < 2 Then Set R = R.Offset(1)
R.ClearContents
'Show the user that we are working
Application.Cursor = xlWait
DoEvents
For Each ThisFile In .FoundFiles
'Get the date from the file name
ThisDate = Filename2Date(ThisFile)
'Between our dates?
If (ThisDate >= StartDate) And (ThisDate <= EndDate) Then
'Import at the end of the data
Set R = Range("A" & Rows.Count).End(xlUp).Offset(1)
Data = ReadCSV(ThisFile)
R.Resize(UBound(Data) + 1, UBound(Data, 2) + 1) = Data
Count = Count + 1
End If
Next
End With
'Done
Application.Cursor = xlDefault
If Count = 0 Then
MsgBox "No files match your dates"
Else
MsgBox Count & " files imported"
'Hide the form
Me.Hide
End If
End Sub
Private Function Filename2Date(ByVal Fullname As String) As Date
'Convert e.g "C:\20130601142648DataLog.txt" to the date "01.06.2013 14:26:48"
Dim i As Long, j As Long
i = InStrRev(Fullname, "\")
If i > 0 Then Fullname = Mid(Fullname, i + 1)
Fullname = JustNumbers(Fullname)
If Len(Fullname) <> 14 Then Exit Function
Filename2Date = _
DateSerial(Mid(Fullname, 1, 4), Mid(Fullname, 5, 2), Mid(Fullname, 7, 2)) + _
TimeSerial(Mid(Fullname, 9, 2), Mid(Fullname, 11, 2), Mid(Fullname, 13, 2))
End Function
Private Function JustNumbers(ByVal What As String) As String
'Return only numbers from What (by Rick Rothstein)
Dim i As Long, j As Long, Digit As String
For i = 1 To Len(What)
Digit = Mid$(What, i, 1)
If Digit Like "#" Then
j = j + 1
Mid$(What, j, 1) = Digit
End If
Next
JustNumbers = Left$(What, j)
End Function
Private Function ReadCSV(ByVal Fullname As String) As Variant
'Read a CSV file into an array
Const LDelim = vbCrLf 'Line delimiter
Const FDelim = ";" 'Field delimiter
Dim hFile As Integer
Dim Buffer As String
Dim Lines, Line, Data
Dim i As Long, j As Long
'Be sure the file exists
If Dir(Fullname) = "" Then Exit Function
'Open and read all data
hFile = FreeFile
Open Fullname For Binary Access Read As #hFile
Buffer = Space(LOF(hFile))
Get #hFile, , Buffer
Close #hFile
'Split into lines
Lines = Split(Buffer, LDelim)
'Split the first line and prepare the output
'Note: I assume that all lines have the same number of fields
Line = Split(Lines(0), FDelim)
ReDim Data(0 To UBound(Lines), 0 To UBound(Line))
For i = 0 To UBound(Lines)
Line = Split(Lines(i), FDelim)
For j = 0 To UBound(Line)
'Parse the fields
If IsDate(Line(j)) Then
Data(i, j) = CDate(Line(j))
ElseIf IsNumeric(Line(j)) Then
Data(i, j) = CDbl(Line(j))
Else
Data(i, j) = Line(j)
End If
Next
Next
ReadCSV = Data
End Function -
Is it possible to import a Fixed Text file that does not have a header?
I'm trying to import a Fixed Text file through Import Manager, but the text file I am receiving does not have a header on it (the first row is valid data). When I try importing this, Import Manager uses the first row of data as the headings. Is there any way to turn this off and tell Import Manager there is no header data in the file?
Thanks!Hi Ryan ,ur requirement can be met only when u import the file as ODBC .for this follow the below steps.
1)Go to control panel,in ur settings,select administrative tools
2) In that select DATA SOURCE(ODBC ).
3)Go to SYSTEM DSN tab select tab .
4)Select ur file type MICROSOFT TEST DRIVER (.txt,.csv)
5)Double click on "Import DSN" and in the blank give the name of DATA SOURCE NAME any name u want to give.
6)Uncheck the use current directory box and select the directory ur file is it will automatically show ur source file select it and click ok.
7) Now when u import ur file as ODBC give the name of ur DATA source name which u have given and it will show ur file in the source preview itself .
In this way u can import ur file as ODBC.
Hope this may help u.
Regards
Ankit -
Skip a column when importing a text file into Excel 2010
Hi,
I have a formatted Excel 2010 spreadsheet that I want to import data from a .txt file located on my local drive. The third column of the spreadsheet is a concantenate formula that converts the second column from a Hex formatted value to a Dec formatted value.
I want the first two columns of the text file to import into the first two columns of the spreadsheet and skip the third column then import the remaining columns from the text file to the spreadsheet. Is there an easy way to do this or do I need a VBA code
and if so can you provide that to me?
Thank you,
JenniferHi Tony,
I am sorry if I didn't express my issue more clearly. Where I need to skip a column is in the Excel spreadsheet. I want to import all the columns from the text file. I want the first two columns from the text to import to the first two columns in the Excel
sheet A and B, skip the third column C in the spreadsheet, where I have a formula to convert the second column B values from a Hex format (imported data) to a Dec format, then continue to import columns 3, 4, and 5 from the text to spreadsheet columns D, E,
and F. I would think the function would be in the Excel spreadsheet maybe some type of protection setting or something similar, if it can even be done.
Thank you for taking the time to help me out with this.
Jennifer
Maybe you are looking for
-
White with vertical colored lines on Equium A60
Hi I am new to this but really need your help. My laptop is about 18 months old and has always worked fine. Last week I plugged a broadband modem into it through an Ethernet cable and set up broadband. A couple of minutes after doing this when I look
-
Hi all, Kindly tell me that if a PO has been created with wrong vendor and service entry sheet and invoice parking has also been done then what are the steps of reversal? I mean i know that first parked invoice will be reversed , then service entry
-
Low internet download speed when on battery (have tried previously given fix)
There is a drastic fall in internet download speeds when laptop is running on battery power. As soon as I plug it in, the internet speeds return to normal.I have already changed the wireless settings to high performance in the power management profil
-
Flex 20 - Sensor Firmware Update
After updating to Windows 8.1 There is an error with the accelerometer and the HID Sensor Collection dll won't load. The Lenovo Windows 8.1 Update Guide says that this is a known problem and to get a firmware update from the download centre. (http://
-
Is it possible to take a video from iphone??
1.i was trying to shoot a video from my i phone...but i coudn't do that..is there any other way to do it.... 2. is it possible to assign songs as ur ringtone.????