Jump to content



Photo

PC LOCATION


  • Please log in to reply
12 replies to this topic

#1 MrTiz

MrTiz

    Seeker

  • Active Members
  • 27 posts

Posted 12 October 2010 - 02:43 PM

Hi, I' would get the location (geographical) off the pc where running the script; It's possible???

Sorry for my bad english, but I'm italian and I don't speak english very well





#2 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,476 posts

Posted 12 October 2010 - 03:26 PM

Hi, I' would get the location (geographical) off the pc where running the script; It's possible???

Sorry for my bad english, but I'm italian and I don't speak english very well


You can try to automate this by using your external ip in this website ! Posted Image

Edited by wakillon, 12 October 2010 - 03:28 PM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#3 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 886 posts

Posted 12 October 2010 - 03:54 PM

Running this script should return the country of origin.

#include <FF.AU3> #include <String.AU3> #include <array.au3> Global $Bin = InetRead ("<a href='http://www.ip-details.com/ip-search/' class='bbc_url' title='External link' rel='nofollow external'>http://www.ip-details.com/ip-search/"</a>) Global $Page = BinaryToString ($Bin) $country = _StringBetween($page, 'countryspan">' , '</span>') msgbox (0, '' , $country[0])

Spoiler

#4 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,476 posts

Posted 12 October 2010 - 04:13 PM

You can get more precise location:

#include <Inet.au3> #include <IE.au3> $oIE= _IECreate ( 'http://en.utrace.de/?query=' & _GetIP ( ), 0, 1, 1 )

Edited by wakillon, 12 October 2010 - 04:18 PM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#5 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 886 posts

Posted 12 October 2010 - 04:50 PM

A little more granular

#include <String.AU3> #include <array.au3> Global $Bin = InetRead ("<a href='http://www.ip-details.com/ip-search/' class='bbc_url' title='External link' rel='nofollow external'>http://www.ip-details.com/ip-search/"</a>) Global $Page = BinaryToString ($Bin) $Address = _StringBetween ($Page, 'addressspan">' , '</span>') $country = _StringBetween($page, 'countryspan">' , '</span>') $longlat = _StringBetween ($page, 'latlongspan">' , '</span>') $longlatstring = _ArrayToString($longlat) $longlatstring2 = StringStripWS ($longlatstring, 1) msgbox (0, '' , $country[0] & ", Nice Country!" & "  People are now en route to " & $Address[0] & "." & "  Weaponary is now aimed at " & $longlatstring2)

Spoiler

#6 wakillon

wakillon

    Tiny Tools Coder

  • Active Members
  • PipPipPipPipPipPip
  • 2,476 posts

Posted 12 October 2010 - 04:55 PM

Or in xml form with all details !

#include <String.AU3> #include <Inet.au3> $Bin = InetRead ( 'http://xml.utrace.de/?query=' & _GetIP ( ) ) $Page = BinaryToString ( $Bin ) ConsoleWrite ( "$Page : " & $Page & @Crlf ) $_Country = _StringBetween ( $page, '<countrycode>', '</countrycode>' ) ConsoleWrite ( "!-->- Country : " & $_Country[0] & @Crlf ) $_Region = _StringBetween ( $page, '<region>', '</region>' ) ConsoleWrite ( "!-->- Region  : " & $_Region[0] & @Crlf )

Edited by wakillon, 12 October 2010 - 04:56 PM.

  AutoIt Version : 3.3.8.1/3.3.9.4 SciTE 3.3.0 Language:040C OS:WIN_7/ CPU:X64 OS:X64 

  Last updated Scripts and executables with full embedded files are available on : GoogleCode 


#7 LordJugag

LordJugag

    Wayfarer

  • Active Members
  • Pip
  • 65 posts

Posted 12 October 2010 - 05:01 PM

A little more granular

#include <String.AU3> #include <array.au3> Global $Bin = InetRead ("http://www.ip-details.com/ip-search/") Global $Page = BinaryToString ($Bin) $Address = _StringBetween ($Page, 'addressspan">' , '</span>') $country = _StringBetween($page, 'countryspan">' , '</span>') $longlat = _StringBetween ($page, 'latlongspan">' , '</span>') $longlatstring = _ArrayToString($longlat) $longlatstring2 = StringStripWS ($longlatstring, 1) msgbox (0, '' , $country[0] & ", Nice Country!" & "  People are now en route to " & $Address[0] & "." & "  Weaponary is now aimed at " & $longlatstring2)

Your script is funny :)

You can separate address with a comma? For example: Street, Number, District, ZIP Codes, City ;)

Edited by LordJugag, 12 October 2010 - 05:38 PM.


#8 guinness

guinness

    guinness

  • MVPs
  • 10,248 posts

Posted 13 October 2010 - 10:38 AM

I found this topic: http://www.autoitscript.com/forum/index.php?showtopic=67511&view=findpost&p=500084 and had a go at eliminating _StringBetween() and instead opting for StringRegExp(). Based on the idea by wakillon.

Function:
AutoIt         
; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetIP_Country ; Description ...: Gets details about the Country of orgin of your IP address. ; Syntax ........: _GetIP_Country() ; Parameters ....: None ; Return values .: Success - Array with IP, ISP, Region & Country Code. ;                  Failure - Returns -1 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GetIP_Country()     Local $aReturn, $aXML[5] = [4, 'ip', 'isp', 'region', 'countrycode']     Local $sRead = BinaryToString(InetRead('http://xml.utrace.de/?query=' & _GetIP()))     For $i = 1 To $aXML[0]         $aReturn = StringRegExp($sRead, '<' & $aXML[$i] & '>(V*)</' & $aXML[$i] & '>', 3)         If @error Then             ContinueLoop         EndIf         $aXML[$i] = $aReturn[0]     Next     Return $aXML EndFunc   ;==>_GetIP_Country

Example use of Function:
#include <Array.au3> ; Not Required, Only Needed For _ArrayDisplay() #include <Inet.au3> Local $aCountry = _GetIP_Country() _ArrayDisplay($aCountry)

Edited by guinness, 03 October 2012 - 09:40 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#9 guinness

guinness

    guinness

  • MVPs
  • 10,248 posts

Posted 05 January 2011 - 11:08 PM

Improved >> http://www.autoitscript.com/forum/topic/120774-pc-location/page__view__findpost__p__839358 Now it's a standalone Function without the requirement for any #includes.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#10 Oviyaa

Oviyaa

    Seeker

  • Active Members
  • 7 posts

Posted 10 February 2011 - 04:59 PM

You can find ip location making use of this site http://www.ip-details.com/ , it provides information at free cost & very good in service ..

#11 ChrisL

ChrisL

    Mass Spanner!

  • Active Members
  • PipPipPipPipPipPip
  • 1,746 posts

Posted 10 February 2011 - 08:11 PM

You can find ip location making use of this site http://www.ip-details.com/ , it provides information at free cost & very good in service ..


That one was miles out for my IP address

#12 kylomas

kylomas

    Want to see God laugh? Tell him you have plans!

  • Active Members
  • PipPipPipPipPipPip
  • 2,032 posts

Posted 10 February 2011 - 08:23 PM

MrTiz,

The solution by guinness in post #9 works best for me. I get the actual IP address even though I'm behind a router.

kylomas
"Really?, How Do you know the're not random numbers?"Forum Rules

#13 guinness

guinness

    guinness

  • MVPs
  • 10,248 posts

Posted 10 February 2011 - 08:25 PM

The solution by guinness in post #9 works best for me. I get the actual IP address even though I'm behind a router.

Thanks!

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users