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

In my post  https://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.

Advertisements

2 Responses

  1. Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

  2. Nice, Info
    I’m Really need it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: