Remove line from .txt / convert .pdf to .txt /format cell
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 12
- Joined: Mon Mar 10, 2008 6:26 pm
Remove line from .txt / convert .pdf to .txt /format cell
I have a large text document from which I am importing particular lines of text into excel; however, I need to delete or completely remove any and all lines that begin with one of the following:
[code]
Page
Task Name Start Finish
"blank line with no text written to it. like a CRLF"
[/code]
After the lines are removed, I can't have any empty lines.
How can one convert a .pdf file to a .txt file using Macro Scheduler?
When using the following code, The combined lines are entered as one sentence into the Excel cell. Is it possible to add a soft return, such as ALT-ENTER would do when working within Excel?
[code]
//where JNSLine=starting line of corresponding job number data
//subStoreStatus------------------------------------subStoreStatus
SRT>subStoreStatus
ReadFile>%NPFilepath%,inFile
Separate>inFile,CRLF,lines
Let>k=%JNSLine%-1
Repeat>k
Let>k=k+1
Let>this_line=lines_%k%
Position>#,this_line,1,p
If>p=1
//found line starting with #,
If>combined
//output combined to Excel
DDEPoke>Excel,%ExcelFilepath%,R%RowCount%C3,%combined%
DDEPoke>Excel,%ExcelFilepath%,R%RowCount%C8,%date%
END>subStoreStatus
Endif
//reset combined
Let>combined=
Else
Let>combined=%combined% %this_line%
Endif
Until>k=lines_count
END>subStoreStatus
[/code]
Why do the excel cells not expand when data is inserted into them? I have text wrap on for each cell.
[code]
Page
Task Name Start Finish
"blank line with no text written to it. like a CRLF"
[/code]
After the lines are removed, I can't have any empty lines.
How can one convert a .pdf file to a .txt file using Macro Scheduler?
When using the following code, The combined lines are entered as one sentence into the Excel cell. Is it possible to add a soft return, such as ALT-ENTER would do when working within Excel?
[code]
//where JNSLine=starting line of corresponding job number data
//subStoreStatus------------------------------------subStoreStatus
SRT>subStoreStatus
ReadFile>%NPFilepath%,inFile
Separate>inFile,CRLF,lines
Let>k=%JNSLine%-1
Repeat>k
Let>k=k+1
Let>this_line=lines_%k%
Position>#,this_line,1,p
If>p=1
//found line starting with #,
If>combined
//output combined to Excel
DDEPoke>Excel,%ExcelFilepath%,R%RowCount%C3,%combined%
DDEPoke>Excel,%ExcelFilepath%,R%RowCount%C8,%date%
END>subStoreStatus
Endif
//reset combined
Let>combined=
Else
Let>combined=%combined% %this_line%
Endif
Until>k=lines_count
END>subStoreStatus
[/code]
Why do the excel cells not expand when data is inserted into them? I have text wrap on for each cell.
Last edited by Snickers76 on Thu May 29, 2008 3:21 pm, edited 1 time in total.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
1. You can loop through the text file, writing the "keeper" lines to a new file, and skipping by the "throw away" lines.
2. You can use Macro Scheduler to call a PDF utility program that will convert PDF to text. See PDF995 Suite as an example at http://www.pdf995.com
2. You can use Macro Scheduler to call a PDF utility program that will convert PDF to text. See PDF995 Suite as an example at http://www.pdf995.com
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
-
- Newbie
- Posts: 12
- Joined: Mon Mar 10, 2008 6:26 pm
Thanks Bob, that sounds effective enough. I'll give that a try and see what it comes up with.Bob Hansen wrote:1. You can loop through the text file, writing the "keeper" lines to a new file, and skipping by the "throw away" lines.
EDIT: Ok, I looped it but i cant seem to omit the blank line nor the odd character.
I can manually convert my pdf to a text file. However, instead of opening my pdf file and manually converting it, I was wondering if it was possible to convert it using direct MScheduler code instead of the macro repeating the actions I would normally take if i were doing it manuallyBob Hansen wrote:2. You can use Macro Scheduler to call a PDF utility program that will convert PDF to text. See PDF995 Suite as an example at http://www.pdf995.com
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
There's no magic bullet/simple algorithm that will convert a pdf to text so, while it could surely be done, it would be a huge amount of work to write a robust macroscheduler routine for this purpose. Better to automate someone else's program as Bob suggests. There are plenty of command line pdf-text converters which would be very easy to integrate into a macro.
-
- Newbie
- Posts: 12
- Joined: Mon Mar 10, 2008 6:26 pm
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I use the full adobe version. I open the pdf and then click file/save as text. I was hoping to avoid this step without the user having to open the pdf file; however, I'm reluctant to use any free software on the office computers. I will take some more time tonight to give these pdf-text commandline programs a look.
Thank you for recommending these.
Thank you for recommending these.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
This was an issue within excel. It was intermittent for some unknown reason. Some cells were auto sizing while others were not. The excel sheet was brand new, so I had done no formatting to it; however, all cells were not acting the same. I simply selected all excel cells and formated the rows to "autofit".edauthier wrote:I am wondering if you resolved this issue. Do you mean to say that the data is getting truncated or is it simply a display issue that you are writing about?Why do the excel cells not expand when data is inserted into them? I have text wrap on for each cell.
This issue has dissappeared now.