• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Algorithm Help

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone. I am writing a program that uses the Java Robot class to basically do all of the keystrokes that a human would do in order to complete a certain process. The Robot performs these keystrokes on another windows program. My goal is to basically find a certain folder from a very large list. I search for this folder by hitting F2 when I land on one and copying the highlighted name into the clipboard, then comparing it against the folder I am looking for(F2 is rename). I know this isn't the best way to do things, but it works, lol, and I don't see another way. The part I need help with is actually finding the folder. The algorithm I developed basically goes down the list by 100 until the current folder number is within a 100 range of the folder number we are looking for. Then I begin moving by one. A problem I have encountered however, is that some people named the folders with zeroes in front, i.e. S05-05555. Since this program orders the folders by String value, these numbers come before any number that does'nt begin with a zero. Therefore if I am looking for 4444 and I run into 05555, then my code will change the direction of the movement upwards, because the current number si higher then the one were looking for, even though it comes before the one I am looking for(making any sense?). Could someone offer a solution for this. I also implement checks to see that I don't end up in an infinite loop because the numbers are all consecutive, so someitmes you can end up moving between the same two folders.

- Thank You!!
Posts: 43028
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello "Computer Whiz"-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

Enjoy your time here.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic