Jump to content

Recommended Posts

Posted

Hey all,

  • I am trying to open the below file which I can.
  • I then go to the power consumption section using ctrl + f
Here I want to read the next 4-5lines from the pdf and have them paste into a notepad- text file.

Below in the picture I only want the first 5 columns so excluding the one with lots of text.

Can anyone point me in the right direction???

; TODO: change filename to input argument
Local Const $PDFFileName = 'c:\acra\datasheet\adc_126.pdf'

; TODO:? pdf viewer
Local Const $PDFViewer = "C:\Program Files\SumatraPDF\SumatraPDF.exe"

; how to concatenate multiple strings into one
Local $RunString = $PDFViewer & " " & $PDFFileName

local $testFun2Result_string = TestFunc2('PDF will open now...')



; open pdf viewer with the file
Run( $RunString )

;Navigate to power consumption table within the ADC_126 pdf
_WinWaitActivate("ADC_126.pdf - [untitled] - SumatraPDF","")
Send("{CTRLDOWN}f{CTRLUP}power{SPACE}consumption{ENTER}")

pic.docx

Posted

You're opening the file in the PDF viewer... then using the viewer's search function to find what you need...

The ideal approach would be to convert the PDF to a plain text file first, then run some regexp on the document to get what you need.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Posted

I know that sounds and probably is easier.

But as a restiction I need to work with the pdf file.

Just to get that data of the power cosumption and output it as a csv file in notepad.

Posted

Use the AutoIt window info tool to see if the 'text' is accessible. Then you can try

WinGetText()
or
ControlGetText()
on it to obtain the text then run some regexp on it.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...