Sign in to follow this  
Followers 0
Damein

GeoLocation or other means of locating user

7 posts in this topic

I've searched on the forum for a bit and all the Geolocation scripts don't see to work anymore and I don't have a great ton of experience outside of AutoIt so I'd like to stay in that field.


So what I am attempting to do is a location-identifier type of piece to my program I'm writing but can't quite seem to get it to work how I need it to. Maybe I don't quite need Geolocation or anything but I feel like I am looking at this wrong.

Here is what I am trying to achieve:

Get the current time and City (or location) of the user.

My current setup is like this

Using an HTML page locally

 

<!DOCTYPE html>
<html lang="en">
<head>


<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">

<title>BLANKTITLE</title>

<style>
/* Basics */
html, body {
    display:table;
    width: 100%;
    height: 100%;
    margin:0;
    font-family: 'Helvetica Neue', Helvetica, sans-serif;
    color: #444;
    -webkit-font-smoothing: antialiased;
    -moz-font-smoothing: antialiased;
    background: #f0f0f0;
}
#map {
        height: 50%;
        width: 50%;
        margin:auto;
      }

body {
    display:table-cell;
    vertical-align:middle;
 }
#container {
    width: 21.25em;
    padding:1.25em 0;
    margin:auto;
    background: #fff;
    border-radius: 0.25em;
    border: 1px solid #ccc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow:hidden;
 }
label {
    color: #555;
    display: inline-block;display: block;
    margin-left: 1.25em;
    padding-top: 0.625em;
    font-size: 0.875em;
 }
input {
    font-family: 'Helvetica Neue', Helvetica, sans-serif;
    font-size: 0.75em;
    outline: none;
 }
input[type=text],
input[type=password] {display:block;
    color: #777;
    padding-left: 0.625em;
    margin: 0.625em;
    margin-top: 0.75em;
    margin-left: 1.125em;
    width: 25.15em;
    height: 2.1875em;
    border: 1px solid #c7d0d2;
    border-radius: 2px;
    box-shadow: inset 0 1.5px 3px rgba(190, 190, 190, .4), 0 0 0 5px #f5f7f8;
    transition: all .4s ease;
 }
input[type=text]:hover,
input[type=password]:hover {
    border: 1px solid #b6bfc0;
    box-shadow: inset 0 1.5px 3px rgba(190, 190, 190, .7), 0 0 0 5px #f5f7f8;
 }
input[type=text]:focus,
input[type=password]:focus {
    border: 1px solid #a8c9e4;
    box-shadow: inset 0 1.5px 3px rgba(190, 190, 190, .4), 0 0 0 5px #e6f2f9;
 }
#lower {
    background: #ecf2f5;
    width: 100%;
    height: 4.3125em;
    margin-top: 1.25em;
    box-shadow: inset 0 1px 1px #fff;
    border-top: 1px solid #ccc;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
 }
input[type=checkbox] {
    margin-left: 1.25em;
    margin-top: 1.875em;
 }
.check {
    margin-left: 0.1875em;
    font-size: 0.6975em;
    color: #444;
    text-shadow: 0 1px 0 #fff;
 }
input[type=submit] {
    float: right;
    margin-right: 12.5em;
    margin-top: 1.25em;
    /*width: 5em;*/
    height: 1.875em;
    font-size: 0.875em;
    font-weight: bold;
    color: #fff;
    background-color: #acd6ef; /*IE fallback*/
    background-image: linear-gradient(90deg, #acd6ef 0%, #6ec2e8 100%);
    border-radius: 1.875em;
    border: 1px solid #66add6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .5);
    cursor: pointer;
 }
input[type=submit]:hover {
    background-image: linear-gradient(90deg, #b6e2ff 0%, #6ec2e8 100%);
 }
input[type=submit]:active {
    background-image: linear-gradient(90deg, #6ec2e8 0%, #b6e2ff 100%);
 }
</style>

</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br>
<!-- Begin Page Content -->
<div id="container">
 <form action="#" name="form1" id="form1">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username" value="BLANKNAME" readonly>
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" value="BLANKPASS" readonly>
  <label for="text">Latitude:</label>
  <input type="text" id="latitude" name="latitude" readonly>
  <label for="text">Longitude</label>
  <input type="text" id="longitude" name="longitude" readonly>
 </form>
<!-- container --></div>
<script>
   if(!navigator.geolocation) {
    throw 'Geolocation not supported!';
} else {
    // Get current position
    navigator.geolocation.getCurrentPosition(getPos);
}
// Function used in navigator.geolocation.getCurrentPosition method.
function getPos(pos) {
    var lat = pos.coords.latitude;
    var long = pos.coords.longitude;

document.getElementById("latitude").value = lat;
document.getElementById("longitude").value = long;

}
</script>
</body>
</html>

 

It pulls their Latitude/Longitude

Then ideally I would then pull that data from the page and then I would need to input it into something else that would then give me my location ect. But two problems.

A: I can't get AutoIt to read the data from the input boxes.

B: This seems like a LOT more work than is necessary.

So now before I go into it any further I'd like to ask if anyone else has a simpler solution. The only thing I want to restrict on it is I don't want Time/Location via IP. I want it via location or some other means. The application will be used by service technicians to check in on various job sites and will then be using a mobile hotspot which will result in their location being wherever their provider is located not the actual device.

Here is my code for attempting to grab the data from the HTML, that doesn't work.

 

; Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate()
_IENavigate($oIE, @ScriptDir & "/Blank Clock Form.html")
Sleep(2000)
Local $oForms = _IEFormGetCollection($oIE)
Local $iNumForms = @extended
MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & $iNumForms & " forms on this page")
Local $oForm
For $i = 0 To $iNumForms - 1
    $oForm = _IEFormGetCollection($oIE, $i)
    MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
Next

 


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



Hmm.. any takers?


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

To solve the user must allow you pulling his private data (his location) from site: 5725bee30e4b1_59_BLANKTITLE-InternetExpl after he did this you can pull data in different ways, have a look on the examples of the IE.au3.

 

Btw.: my real location is more than 700 km different from the location your page says.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

33 minutes ago, AutoBert said:

.....

Btw.: my real location is more than 700 km different from the location your page says.

maybe you are connected over a (remote) proxy..... ?

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
25 minutes ago, Chimp said:

maybe you are connected over a (remote) proxy..... ?

I connect via mobile broadband device.  

Share this post


Link to post
Share on other sites

so, maybe all mobile devices are connected over the broadband provider's local repeater, and exposed to internet over a centralized proxy (located elsewhere even 700km away...)


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

From my experience, If you are connecting via a mobile broadband service you will have trouble determining location even to the correct country, let alone the correct city. Static IP addresses are not a reliable method of determining location either. I have a static IP address and live in Southampton UK on but websites think I'm in Blackburn in the north of England 400Km away.

 


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0