The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    Here's an Oddball.... Batch File Question!

    Discussion in 'Panasonic' started by Toughbook, May 22, 2014.

  1. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    Okay guys... This isn't Toughbook related but you guys are still the most talented and smartest group out there... So I thought I would post the question here.

    I have written tons of Batch files over the years but I have to admit I am WAY rusty... And I just don't have the time to try to figure this one out right now. Here's the poop...

    I am trying to get some of my customers to log onto a website to refresh their inventory online. Most of my dealers do this daily but there is a definite competitive edge by updating hourly. However, most of my dealers are either too busy or too lazy to do this. So I thought I would play around with a Batch file to do it for them.

    Here's what it would need to do... Open Internet Explorer (Or whatever browser they use) go to a certain website... Enter their logon, enter their password and then click one button. Then the file could either leave the site up or shut down the browser. Obviously I would need to edit this for every dealer as they all have different logons and passwords.

    Does this sound doable? My first thought was yes... But then I start thinking about Batch file commands being DOS based and I think it won't work.

    Any thoughts?
     
  2. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    Update... Looks like VBScript is the way to go!
     
  3. Shawn

    Shawn Crackpot Search Ninja and Options Whore

    Reputations:
    1,541
    Messages:
    8,306
    Likes Received:
    2,050
    Trophy Points:
    331
    I am far from being a programmer of any kind, but I was thinking of some sort of java script type of thing.....
    The VBScript sounds like the right direction to go...................
     
  4. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    Yup... I have it so I can call up the website and log on... I just need to find the correct syntax to click a certain button and then to log off. But it works pretty well so far.

    (EDIT: Rob... I was practicing on TBT so if you see a ton of logons and logoffs... That's why!)

    Now I just need to learn how to select a certain button to push... I almost have it!

    Next I will want to (most likely) try to automate it so it logs on by itself every hour to click the button! LOL
     
  5. Shawn

    Shawn Crackpot Search Ninja and Options Whore

    Reputations:
    1,541
    Messages:
    8,306
    Likes Received:
    2,050
    Trophy Points:
    331

    I'll ask my coworkers.....They always seem to know what buttons to push.......my buttons anyway......
     
  6. SHEEPMAN!

    SHEEPMAN! Freelance

    Reputations:
    879
    Messages:
    2,666
    Likes Received:
    517
    Trophy Points:
    131
    Rick,
    I was researching a file type today...relates to gps BUT the file ***.ptr written in C++ has the capability of deleting itself and what it did. Forevermore FWIW.
    Automagic passwords scare me.

    Again...FWIW.

    J'd
     
  7. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    Deleting itself scares me... LOL Not to mention C++

    I am just trying to help out lazy people. All I want it to do is to logon on... press one button and then log itself off.
     
  8. kode-niner

    kode-niner Notebook Consultant

    Reputations:
    34
    Messages:
    276
    Likes Received:
    113
    Trophy Points:
    56
    Could be simple. Is your login a simple htpasswd type? And is your button some sort of flash or javascript or just a plain URL?
     
  9. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    Basically this is what I want to do... Log onto a website via username and password, click on a button that refreshes inventory and then click the logout button to log off the site.

    Writing the VBScript to open the browser, enter the username and password and then log on is the easy part. But the syntax of having it click the "Refresh Inventory" button and then logging off is where I am stuck.

    It is just plain HTML as far as I can see.
     
  10. kode-niner

    kode-niner Notebook Consultant

    Reputations:
    34
    Messages:
    276
    Likes Received:
    113
    Trophy Points:
    56
    I was thinking more along the lines of a Windows version of the well-known wget command-line program that could do what you're asking, providing the username and passwords are of the htpasswd variety and the button is simply a URL. It could probably be done in a single command line like this:

    Code:
    wget --user=USERNAME --password=PASSWORD http://the-url-that-is-under-the-button-you-want-to-click
    Anyway, you seem far off enough in your VBScript to not bother with this. I guess I was just thinking aloud. :D
     
  11. Toughbook

    Toughbook Drop and Give Me 20!

    Reputations:
    1,267
    Messages:
    7,361
    Likes Received:
    370
    Trophy Points:
    251
    So far... This is all I can get to work... My example is logging on to TBT...

    Set IE = CreateObject("InternetExplorer.Application")
    IE.navigate "http://www.toughbooktalk.com"
    IE.Visible = True

    While IE.Busy
    WScript.Sleep 50
    Wend

    Set ipf = IE.document.all.username
    ipf.Value = "UserName"
    Set ipf = IE.document.all.password
    ipf.Value = "Password"
    ipf.Click

    I just have the problem of finding the other buttons. I can click on "View Source" to see what I am supposed to click on... I just don't have the correct syntax yet to click other buttons...
     
  12. Shawn

    Shawn Crackpot Search Ninja and Options Whore

    Reputations:
    1,541
    Messages:
    8,306
    Likes Received:
    2,050
    Trophy Points:
    331
    what is the entire url for the button? The button is just a link isn't it?

    example
    IE.navigate "http://www.toughbooktalk.com/viewforum.php?f=10&sid=4cb8ef46e712240654335950493cc508"

    total guess but can you set the script/webpage to just timeout? That's what p--pal and other similar sites will do if you don't click on something.