Scan Pdf by using SilkTest 软件测试
Here is an example that scan special PDF file page one by one. It want to know whether there is a blue change bar one the left of every page, if yes, it will print the page number. At the end, the script will calculate the total number of page which has the blue change bar. The most important function the script used is GetHandle(), GetDC() and GetPixel() which provided by Windows Dlls.
view plaincopy to clipboardprint?
01.[ ] use "c:\Program Files\Borland1\SilkTest\msw32.inc"
02.[ ] use "c:\Program Files\Borland1\SilkTest\mswfun32.inc"
03.[ ] use "c:\Program Files\Borland1\SilkTest\mswconst.inc"
04.[ ] use "c:\Program Files\Borland1\SilkTest\Registry.inc"
05.[ ] use "c:\Program Files\Borland1\SilkTest\OCR.inc"
06.[ ]
07.[-] dll "user32.dll" // used for GetPixel / Window functions
08. [ ] DWORD GetDC (HWND nWnd optional)
09. [ ] INT ReleaseDC (HWND hWnd optional, DWORD hDC)
10. [ ] BOOL ShowWindow(HWND hWnd, INT nCmdShow)
11. [ ] BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, INT X, INT Y, INT cx, INT cy, UNSIGNED INT uFlags)
12. [ ] ansicall LONG MessageBoxA( HWND my_hWnd, inout LPSTR my_sText, inout LPSTR my_sCaption, LONG wType )
13. [ ] BlockInput(INT iVal)
14.[ ]
15.[-] dll "gdi32.dll" // used for GetPixel
16. [ ] COLORREF GetPixel (DWORD hdc, INT nXPos, INT nYPos)
17. [ ] VOID SetPixel (DWORD hdc, INT nXPos, INT nYPos, COLORREF cColor)
18.[ ]
19.[-] dll "kernel32.dll" // TODO funktioniert noch nicht
20. [ ] LONG GetDiskFreeSpaceExA(inout STRING my_sRootPathName, inout LONG my_FreeBytesAvailableToCaller,
21. inout LONG my_rTotalNumberOfBytes, inout LONG my_rTotalNumberOfFreeBytes)
文章来源于领测软件测试网 https://www.ltesting.net/