tonycst Posted November 19, 2013 Share Posted November 19, 2013 I've been looking for quiet a while now to get coordinates from my built in laptop GPS location device but no luck. Thanks Link to comment Share on other sites More sharing options...
water Posted November 19, 2013 Share Posted November 19, 2013 Windows offers this API. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
tonycst Posted November 20, 2013 Author Share Posted November 20, 2013 Thank you. I have 1 from 0-10 knowledge about use of API. Do you know a post that has this utilized that i could go and take a look at ? Link to comment Share on other sites More sharing options...
lordofthestrings Posted November 20, 2013 Share Posted November 20, 2013 a little clicking arround on the website provides you this HTML which describes how to use these objects with COM Automation. expandcollapse popup<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>A Simple Latitude/Longitude Example</title> </head> <body onload = "GetLatLong()"> <!-- LatLong Location report factory object --> <object id="LatLongFactory" classid="clsid:9DCC3CC8-8609-4863-BAD4-03601F4C65E8" type="application/x-oleobject"> </object> <p>This example requires that you have installed and enabled a driver that can provide latitude and longitude data.</p> <br> <!-- Text boxes used to display LatLong report fields. --> Latitude: <input type="TEXT" name="txtLat" value=""> <br> Longitude: <input type="TEXT" name="txtLon" value=""> <br> Altitude: <input type="TEXT" name="txtAlt" value=""> <br> Altitude error: <input type="TEXT" name="txtAltErr" value=""> <br> Error radius: <input type="TEXT" name="txtErrRad" value=""> <br> Timestamp: <input type="TEXT" name="txtTmL" value=""> <br> <input type="BUTTON" name=btnLLr value="Get LatLong" onclick="GetLatLong()"> <br> <br> <script> <!-- // JScript date object assumes local time. // If you display the timestamp directly, the // the string will show UTC plus the local time zone, // such as "PST". This function ensure that local time // is displayed in the string. function GetTimeString(timestamp) { var datetime = new Date(timestamp); var dateLocal = new Date(); dateLocal.setTime(Date.UTC(datetime.getFullYear(), datetime.getMonth(), datetime.getDate(), datetime.getHours(), datetime.getMinutes(), datetime.getSeconds(), datetime.getMilliseconds())); return dateLocal.toString(); } // Get a latitude/longitude report // and display the values. function GetLatLong() { var reportstatus = LatLongFactory.Status; if(reportstatus == 4) { var report = LatLongFactory.LatLongReport; // Retrieve the properties required to be // supported by all LatLong providers. txtLat.value = report.Latitude; txtLon.value = report.Longitude; txtErrRad.value = report.ErrorRadius; txtTmL.value = GetTimeString(report.Timestamp); // Try to retrieve the non-required properties. try { txtAlt.value = report.Altitude; txtAltErr.value = report.AltitudeError; } catch(e) { txtAlt.value = "Altitude not supported."; txtAltErr.value = "Altitude not supported."; } } else { alert("No location data provider available."); } } --> </script> </body> </html> Link to comment Share on other sites More sharing options...
tonycst Posted November 21, 2013 Author Share Posted November 21, 2013 (edited) Yes i saw that. It confuses me even more. I tried to come up with _WinApi_LocationDisp.LatLongReportFactory taken from Location.LocationDisp.LatLongReportFactory and just added _WinAPI_ at its front but i doubt its gonna work since its not listed in autoit. And if its not listed, does that mean its not supported ? Edited November 21, 2013 by tonycst Link to comment Share on other sites More sharing options...
BrewManNH Posted November 21, 2013 Share Posted November 21, 2013 (edited) I'm guessing the reason it hasn't been written yet is that it's such a niche thing. There's so few computers that actually have a GPS enabled device in them that it probably just hasn't come up before. I've never run into a computer that's GPS enabled myself, and didn't even know such a thing existed, or was needed by anyone. EDIT: I wanted to clarify, I've never seen a computer with it built-in before, I've seen plenty of USB/Serial port connected GPS devices before. Edited November 21, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tonycst Posted November 21, 2013 Author Share Posted November 21, 2013 (edited) Perhaps because those laptops were cheep. Anyhow i need lots of help on this. #include <WinAPI.au3> Dim $latlongfactory $latlongfactory = ObjCreate("LocationDisp.LatLongReportFactory") Dim $Listen $Listen = ObjCreate ("LocationDisp.LatLongReportFactory.ListenForReports") Dim $Report $Report= ObjCreate ("LocationDisp.LatLongReportFactory.LatLongReport",$Listen) MsgBox(0,'',$Report) I am trying to learn API's and this is what i came up with so far. Am sure its wrong but it looks good I need the $report to report something but it gives 0. Because most of these return no value, i cant be sure i do it right. Edited November 21, 2013 by tonycst Link to comment Share on other sites More sharing options...
islandspapand Posted November 21, 2013 Share Posted November 21, 2013 i have a lenovo with "build in GPS" aswell and i have used this code to get the GPS data just change the com port to the one your GPS i connected to This is NOT my code all credit goes to the original author here from autoit forum expandcollapse popup#include <WinAPI.au3> Global $Port1, $Port, $Buffer, $String, $Data $Port1 ="COM17" _OpenPort() for $I = 1 to 100 ; Let's do the cycle 5 times _GetData() Global $TimeStamp = $DATA[2] ; UTC time Global $Lat1= Round((StringRight($DATA[4],7)/60) + StringLeft($DATA[4],2),6) ; Latitude converted to decimal degrees if $DATA[5] = "S" Then $Lat1=$Lat1 * -1 EndIf Global $Lon1= Round((StringRight($DATA[6],7)/60) + StringLeft($DATA[6],3),6) ; Longitude converted to decimal degrees if $DATA[7] = "W" Then $Lon1=$Lon1 * -1 EndIf Global $Speed = Round($DATA[8]*1.852,0) ; Speed is in Knots. Multiply by 1.852 for Km or 1.150779 for miles Global $Bearing = $DATA[9] ; In degrees If $Lat1<>0 And $Lon1<>0 Then consolewrite("Time: " & $TimeStamp & " Latitude: " & $Lat1 & " Longitude: " & $Lon1 & " Speed: " & $Speed&" Km" & " Bearing: " & $Bearing & @CR ) ;FileWriteLine(@ScriptDir&"\GPSLog.txt","Time: " & $TimeStamp & " Latitude: " & $Lat1 & " Longitude: " & $Lon1 & " Speed: " & $Speed & " Bearing: " & $Bearing) Else consolewrite("Waiting for $GPRMC Data from COM port that is different then 0,0" &@CR) EndIf next Func _OpenPort() $Port = _WinAPI_CreateFile($Port1, 2, 2) If $Port = 0 then msgbox(16, "", "No response from port " & $Port1) exit else $Buffer = DllStructCreate("byte[1]") EndIf EndFunc Func _GetData() While 1 _GetString() if StringLeft($String,6) = "$GPRMC" then ; $GPGGA $GPGSV $GPGLL $GPGSA $GPGST $Data = stringsplit($String, ",") Return EndIf WEnd EndFunc Func _GetString() Local $C = 0, $TempString = "", $sText While 1 Local $nBytes=1 _WinAPI_ReadFile($Port, DllStructGetPtr($Buffer), 1, $nBytes) $sText = BinaryToString(DllStructGetData($Buffer, 1)) if $stext=chr(13) or $sText=chr(10) then $C=$C+1 if $C=2 then $String = $TempString $TempString = "" $C=0 Return endif else $TempString= $TempString & $sText EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
tonycst Posted November 22, 2013 Author Share Posted November 22, 2013 Cool thanks. I get no responce from COM17 error. What does that mean ? Is it because my GPS is on a different COM # ? How do u find out which ? Greatly appreciated !!! Link to comment Share on other sites More sharing options...
islandspapand Posted November 22, 2013 Share Posted November 22, 2013 Yes different COM# Right mouse click Computer -> Properties -> Device Manager -> Ports (COM & LPT) -> Your device at least under windows 7 Link to comment Share on other sites More sharing options...
tonycst Posted November 23, 2013 Author Share Posted November 23, 2013 Yes different COM# Right mouse click Computer -> Properties -> Device Manager -> Ports (COM & LPT) -> Your device at least under windows 7 i have windows 7. no such thing as Ports under device manager, just list of all devices. I am not sure what category this device is and what would it be named. Link to comment Share on other sites More sharing options...
tonycst Posted November 24, 2013 Author Share Posted November 24, 2013 I dont think my GPS is on COM port. Its built in. I think its USB but i dont know whats its called or how to access it. I suspect that example i useless for USB built in GPS. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 24, 2013 Share Posted November 24, 2013 The GPS devices I've seen have all been serial port devices, even the ones that plug into a USB port. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tonycst Posted November 24, 2013 Author Share Posted November 24, 2013 The GPS devices I've seen have all been serial port devices, even the ones that plug into a USB port. Please look at my screenshot. Where do i look for it ? Link to comment Share on other sites More sharing options...
BrewManNH Posted November 25, 2013 Share Posted November 25, 2013 Have you tried expanding all of the trees to see where it's located? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tonycst Posted November 25, 2013 Author Share Posted November 25, 2013 (edited) Have you tried expanding all of the trees to see where it's located? I did. I have nothing there that would make me think about GPS or LOCATION Laptop model is Samsung ATIV Book 8 Looking at its specs, i found no clue about its location device name or even if it has one. Its a feature that even manufacturer thought was not important to specify. Edited November 25, 2013 by tonycst Link to comment Share on other sites More sharing options...
islandspapand Posted November 25, 2013 Share Posted November 25, 2013 This is who it look on my pc img.bmp Link to comment Share on other sites More sharing options...
islandspapand Posted November 25, 2013 Share Posted November 25, 2013 #include <WinAPI.au3> #include <WinAPILocale.au3> #include <APILocaleConstants.au3> Local $ID = _WinAPI_GetUserGeoID() ConsoleWrite('ID: 0x' & Hex($ID) & @CRLF) ConsoleWrite('Latitude: ' & _WinAPI_GetGeoInfo($ID, $GEO_LATITUDE) & @CRLF) ConsoleWrite('Longitude: ' & _WinAPI_GetGeoInfo($ID, $GEO_LONGITUDE) & @CRLF) ConsoleWrite('Name: ' & _WinAPI_GetGeoInfo($ID, $GEO_FRIENDLYNAME) & @CRLF) ConsoleWrite('ISO code: ' & _WinAPI_GetGeoInfo($ID, $GEO_ISO3) & @CRLF) Link to comment Share on other sites More sharing options...
tonycst Posted November 25, 2013 Author Share Posted November 25, 2013 ERROR: can't open include file <WinAPILocale.au3>. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 25, 2013 Moderators Share Posted November 25, 2013 tonycst,Are you running the Beta? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now