Computers Problems and Solutions

Windows, Internet, Programming

Posts Tagged ‘source code’

Free MySpace search tool by a Freelancer

Posted by zlatipln on September 24, 2008

I am tired doing programs for a freelance site and not choosing me.

Instead of it, I will publish here for free download some of my programs – most of them are ebay, myspace tools, scrappers and data mining. Also have forum posters, translators-dictionary, and all the Internet stuff that can be automated.

If you have ideas, questions or found bugs – please leave a short comment to let me know.

Soon will start my Autoit tutorial also.

The first program I want to give out for free is MySpace search tool: http://craigmaster.freehostia.com/MsTool.rar

No need to install – just run and type your search words, space separated:

for example: Seattle T-mobile phone, or  Clay Aiken, Dallas yoga or Ohio Google phone or California restaurant or Vegas casino, etc.

Wait program to do the search. Three files are created : the “ms.csv” – results and two temp files – you can delete them.

To terminate program use ESC.

At the end there are all friendIDs found for your search /clay aiken in example./

Soon will post second program which uses that friendID to extract more data from user profiles, even theyr MySpace layout.

Here is the source:

#include<ie.au3>
#include<inet.au3>
#include<array.au3>
#include<file.au3>
Dim $a, $aa
HotKeySet(“{ESC}”, “Terminate”)
$f = FileOpen(‘ms.csv’, 2)
$search0 = InputBox(“searcg box”, “Please type the search words separated by space”)
$search = StringReplace($search0, ‘ ‘, ‘%20′)
$u = “http://searchservice.myspace.com/index.cfm?fuseaction=sitesearch.results&qry=” & $search & “&type=AllMySpace”
InetGet($u, ‘temp.txt’)
_FileReadToArray(‘temp.txt’, $a)
For $ar = 100 To 300
 If StringInStr($a[$ar], ‘ results for’) Then
  $br = SttringBetween($a[$ar], ’span>’, ‘ results for’)
  ;ConsoleWrite($br & @CR)
  ExitLoop
 EndIf
Next
$br = StringReplace($br, ‘,’, ”)
$br = StringReplace($br, ‘of’, ”)
$br = StringReplace($br, ‘ ‘, ”)
FileWriteLine($f, ‘Found:’ & $br & ‘ results for ‘ & $search0)
$br = Number($br)
For $i = 1 To round($br/10)
 HotKeySet(“{ESC}”, “Terminate”) 
 $u1 = “http://searchservice.myspace.com/index.cfm?fuseaction=sitesearch.results&qry=” & $search & “&type=AllMySpace&searchid=f6309e4f-39f2-43c6-9b59-5adef4eaa395&pg=” & $i
 InetGet($u1, ‘temp1.txt’)
 _FileReadToArray(‘temp1.txt’, $aa)
 $lines =$aa[0]
 $rold=”
 For $j = 100 To $lines
  HotKeySet(“{ESC}”, “Terminate”)
  If StringInStr($aa[$j], ‘friendid=’) Then
   $r = SttringBetween($aa[$j], ‘friendid=’, ‘”‘)
   if $r=$rold then continueloop
   if stringlen($r)<9 then
   FileWriteLine($f, $r)
      EndIf
   $rold=$r
  EndIf
 Next
Next
MsgBox(0, ‘READY!’, ‘You can see results in ms.csv file’)
FileClose($f)

Func Terminate()
 FileClose($f)
 Exit 0
EndFunc   ;==>Terminate

Func SttringBetween($s, $from, $to)
 $x = StringInStr($s, $from) + StringLen($from)
 $y = StringInStr(StringTrimLeft($s, $x), $to)
 Return StringMid($s, $x, $y)
EndFunc   ;==>SttringBetween

===========================================================

In next post I will upload source code file in .Au3 format /Autoit/ with comments.

You will be able to compile it, change it and add more features.

Posted in AutoIt, Programming, Software, myspace | Tagged: , , , , , , , , , , , | 3 Comments »

Autoit source code of “open search instead of folder” program

Posted by zlatipln on September 19, 2008

In my post  http://zlatipln.wordpress.com/wp-admin/post.php?action=edit&post=138 I had explained how to manually change registry HKEY_CLASSES_ROOT\Directory\shell in order to resolve the “double click opens search instead of folder”

The program is : http://obama.110mb.com/programs/search_insteadof_open.zip

Here is the AutoIt source code:

;code STARTS here

HotKeySet(“{esc}”, “Terminate”) ;use ESC key to stop the program

Send(“#r”) ;Opens Run window. Same as start button –> Run
WinWaitActive(“Run”) ;waits Run window to appear
Send(“regedt32″) ; same as typing this text in the box
ToolTip(“Now will open Registry Editor” & @CRLF & @CRLF, 200, 500) ;A explanatory Tooltip appears with coordinates 200×500
Sleep(8000) ;program paused for 8 seconds to read the tooltip
ToolTip(”) ; Removes tooltip
Send(“{Enter}”) ;same as pressing OK button or press Enter from keyboard
ToolTip(“Now will search for HKEY_CLASSES_ROOT registry class” & @CRLF & @CRLF, 200, 500)
Sleep(3000)
ToolTip(”)
Send(“+{Home}”) ;in registry editor window, sends Shift+Home key – it is same as going at the begining of registry list to start searching from the root.
ToolTip(“To search for HKEY_CLASSES_ROOT registry class” & @CRLF & @CRLF & “open ‘Edit’ menu –>select ‘Find’ and type HKEY_CLASSES_ROOT”, 500, 200)
Sleep(5000)
Send(“^f”) ;This combination /CTRL + F/ opens Find submenu from Edit menu
Sleep(3000)
Send(“HKEY_CLASSES_ROOT”)
Sleep(2000)
Send(“{Enter}”)
ToolTip(”)
ToolTip(“Now it is searching for HKEY_CLASSES_ROOT registry class” & @CRLF & @CRLF & “Please wait or press ESC to exit”, 200, 500)
While WinExists(‘Find’)  ;checks if Find window appears
 Sleep(10)
WEnd
ToolTip(”)
$fl = 0
$br = 1
While 1
 If $br = 1 Then
  Sleep(4000)
  Send(“^f”)
  Sleep(4000)
  Send(“Directory”)
  ToolTip(“Now it is searching for Directory key” & @CRLF & @CRLF & “Please wait or press ESC to exit”, 200, 500)
  $br += 1
  Sleep(4000)
  Send(“{Enter}”)
  While WinExists(‘Find’)
   Sleep(10)
  WEnd
  ToolTip(”)
  $t = WinGetText(“Registry Editor”)
  If StringInStr($t, ‘HKEY_CLASSES_ROOT\Directory’) Then
   ExitLoop
  Else
   ContinueLoop
  EndIf
 Else
  Sleep(1000)
  Send(“{f3}”)
  ToolTip(“Now it is searching for Directory key” & @CRLF & @CRLF & “Please wait or press ESC to exit”, 200, 500)
  Sleep(500)
  While WinExists(‘Find’)
   Sleep(10)
  WEnd
  $t = WinGetText(“Registry Editor”)
  If StringInStr($t, ‘HKEY_CLASSES_ROOT\Directory’) Then
   ExitLoop
  Else
   ContinueLoop
  EndIf
 EndIf
 If $br > 90 Then Exit
WEnd
$br = 1
While 1
 If $br = 1 Then
  Sleep(4000)
  Send(“^f”)
  Sleep(4000)
  Send(“shell”)
  $br += 1
  ToolTip(“Now it is searching for ’shell’ key” & @CRLF & @CRLF & “Please wait or press ESC to exit”, 200, 500)
  Sleep(4000)
  Send(“{Enter}”)
  While WinExists(‘Find’)
   Sleep(10)
  WEnd
  $t = WinGetText(“Registry Editor”)
  If StringInStr($t, ‘HKEY_CLASSES_ROOT\Directory\shell’) Then
   $fl = 1
   ExitLoop
  Else
   ContinueLoop
  EndIf
 Else
  Sleep(1000)
  Send(“{f3}”)
  ToolTip(“Now it is searching for ’shell’ key” & @CRLF & @CRLF & “Please wait or press ESC to exit”, 200, 500)
  Sleep(1000)
  While WinExists(‘Find’)
   Sleep(10)
  WEnd
  ToolTip(”)
  $t = WinGetText(“Registry Editor”)
  If StringInStr($t, ‘HKEY_CLASSES_ROOT\Directory\shell’) Then
   $fl = 1
   ExitLoop
  Else
   ContinueLoop
  EndIf
 EndIf
 If $br > 20 Then Exit
WEnd
If $fl = 1 Then
 MsgBox(0, ‘Registry key found’, ‘please check if “HKEY_CLASSES_ROOT\Directory\shell” value is “none”‘)
Else
 ToolTip(”)
 MsgBox(0, ‘Exit’, ‘Not found. Will exit’)
 WinClose(‘Registry Editor’)
 Exit
EndIf
Func Terminate()
 Exit 0
EndFunc

;END of Code

AutoIt is a very simple language, similar to Basic.

It is used mainly to automate mouse and keyboard actions.

To make an .exe file from the source text above, you have to download and install the AutoIt compiler

http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe

 and Scite editor:  http://www.autoitscript.com/autoit3/scite/downloads.shtml

They both are small and don’t takee too much place.

Then copy paste the source in Scite editor. Autoit source files have .au3 extension.

Here is the source of my program: http://obama.110mb.com/programs/search_insteadof_open.au3

First save it as somename.au3 then run it from TOOLS meny – run.

If no errors found, you can build an  .exe file from TOOLS menu – Build.

The new .exe has the same name as .au3 file and is found in same folder.

Posted in Programming, Registry, Windows | Tagged: , | 1 Comment »