Link to home
Start Free TrialLog in
Avatar of ddantes
ddantesFlag for United States of America

asked on

Is it possible to force a Works database file to scroll to the top row when it is opened?

On a Windows 7 platform, I frequently use a Microsoft Works 2000 database file, and there is a minor annoyance with it.  It always opens at the lowest row, requiring scrolling to the top.  If there is a simple way to make it open at the top, I'd like to try that.  I know that this is an obsolete file type, but I'm accustomed to it and comfortable with it, and I'd like to continue using it. The database file can't be attached to this question, but it can be downloaded at www.mauitradewinds.com/test.wdb
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ddantes

ASKER

Thank you.  May I ask for some specific guidance to implement your instructions?  There are numerous AutoIT downloads -- which one is required?  Can you provide the code for the scroll up script, or will that be accomplished intuitively with the 3rd party application?  Can you provide code for the .bat file?   I apologize for my lack of expertise in this area.
AutoIt Full Installation https://www.autoitscript.com/site/autoit/downloads/

Make a .au3 file of this code:
Adjust these:
- "Database main window title", "sub window title"
- CTRL-HOME is the keyboard sequence to scroll to the top.

See AutoIT help on SEND and WinWaitActive functions.

WinWaitActive("Database main window title", "sub window title")
Send("^{HOME}")

Open in new window


Assuming Works can open the database file (.wdb) from the command line, your .bat would look like:
"C:\Program Files (x86)\Microsoft Works\WksDb" "c:\folder\filename.wdb"
"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "c:\folder\scroll.au3"

Open in new window

Avatar of ddantes

ASKER

Thank you for your specifications.  I downloaded the full installation.  If I understand correctly, I need to make a au3 file (scroll.au3) from the first two lines of code which you kindly provided.   The .bat file will then launch the database and activate the scroll.au3 file.  

 I am still unclear how to adjust the "Database main window title" and "sub window title".  Can you clarify that please?   I used the Finder Tool and was able to identify the main window title.  I don't see information about a sub window title in the AutoIT Window Information Tool.  The .bat file opens the Works database OK, but it does not scroll to the top.
Avatar of ddantes

ASKER

Another observation:  the "Home" key on the keyboard does not necessarily cause the database to scroll to the top.  Instead, it scrolls to the last cell which was highlighted when the file was closed.
Compare the attached image for my case:
WinWaitActive("Microsoft Excel", "09162015.xls")

Open in new window

User generated image
I don't have Works so can't be certain.

If there is no subwindow, then use blank double-quotes. For my case, it would be:
WinWaitActive("Microsoft Excel", "")

Open in new window


> the "Home" key on the keyboard does not necessarily cause the database to scroll to the top
Assuming there is a way to use the keyboard to scroll to the top, you'll have to figure that out. Check the Works help.

Sometimes, programs use the Ctrl-HOME or Ctrl-PgUp key combination, or something like that. IDK what's the key combo for Works, if any.

If there is no key scroll combo, you could resort to using a series of PgUp keys. Of course, if that's a big database, it could be a lot of PgUps!
Avatar of ddantes

ASKER

Thank you for the example.  I attached a screenshot of the comparable AutoIT Window Information for my application.  The code I'm using in scroll.au3 is:
WinWaitActive("Guest Pocket Cal. 2015-16 - Microsoft Works Database", "")
Send("^{HOME}")

Open in new window


If this looks OK to you, please provide the code for sending two PgUP key strokes, which is sufficient to scroll to the top.User generated image
Try it.

> I'll try to find a keyboard solution to make it scroll to the top.
Not sure if you already confirmed that the macro does work. If not, keep it simple for now.
Example: After you normally start Works (w/o the script) and open the database, notice where the cursor is. Is it it a certain cell?

Then, in the au3 script make a simple keyboard move, e.g. 1 cell left or right. This, just to confirm basic functionality.

Close Works.

Then, start it with the .bat/script.

If the simple keyboard command works, get fancier. Spend some time finding out if Works does have a keyboard combo to take it to the top in one crack. If so, that could save you programming time.

I think you get the idea.
Avatar of ddantes

ASKER

I guess the macro doesn't work.  The file opens, but the SEND command doesn't seem to have an effect.  
WinWaitActive("Guest Pocket Cal. 2015-16 - Microsoft Works Database", "")
Send ("{PGUP}")

Open in new window

 This code does not move the file up at all.
Try putting a SLEEP command before sending the keypress...
WinWaitActive("Guest Pocket Cal. 2015-16 - Microsoft Works Database", "")
; Wait for 2 seconds
Sleep(2000)
Send ("{PGUP}")

Open in new window

Also, in your .bat, reverse the commands. Start autoit first, Works second:

"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "c:\folder\scroll.au3"
"C:\Program Files (x86)\Microsoft Works\WksDb" "c:\folder\filename.wdb"

Open in new window

Also, before starting the .bat, close any prior running AutoIT macros in your taskbar, if any. Right-click the grey AutoIT icon and pick Exit.
Avatar of ddantes

ASKER

"C:\Program Files\AutoIt3\autoIT3.exe"  "C:\Program Files\AutoIt3\Scripts\scroll.au3"
"C:\Program Files\Works 2000\WksDb.exe" "V:\My Documents\Tradewinds\Guest Pocket Cal. 2015-16.wdb"

Open in new window

  Regardless of which order of code appears in the .bat file, only the first line appears to be executed.  If the Works line is on top, the file opens but does not scroll.  If the AutoIT3 line is on top, the Works file doesn't open.  Either way, only one line appears in the command window.
Sorry. Try this:

start "C:\Program Files\AutoIt3\autoIT3.exe"  "C:\Program Files\AutoIt3\Scripts\scroll.au3"
start "C:\Program Files\Works 2000\WksDb.exe" "V:\My Documents\Tradewinds\Guest Pocket Cal. 2015-16.wdb"

Open in new window

Avatar of ddantes

ASKER

Both lines of code now appear in the command window, which then closes.  The AutoIT3 window then opens.  Then the database opens, but does not scroll.
Avatar of ddantes

ASKER

Although I couldn't get this third party application to perform as we had hoped, your instructions solved the issue.  I didn't know I could just tap PgUp  twice, and the cursor would be at the top line of the database.  That's good enough, and thank you!
Glad that works for you... Ddantes