Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/09/2020 in all areas

  1. I don't know if you are like me, but I am always searching for that specific code I wrote over the years, but cannot find it. It was way too exhausting to look at 1k+ scripts. And Windows Explorer is not the best tool to do such exploration. So I made this little script that save me tons of time. Hope you will find it useful too. You can adjust default search folders and type of files you want to search for, but you can also change it at runtime. To use multiple filters separate them with ";" Let me know if you have any suggestion to enhance the tool. Version 2023-12-27 * Code revision : 3.3.16.1 now required Version 2023-05-10 * Sets children flag on first drawn list Version 2021-04-06 * Context menu modified to allow clipping file name and line content Version 2020-11-21 * Allows only 1 running instance of the script * Added right-click support on Tray to exit script Version 2020-06-29 * Added Copy File Name to context menu (helps to copy include files names) Version 2020-04-22 * Added icons to main buttons * Added informative box to describe progress and results of a search * Increased robustness of the GUI * Open Button enabled only under the right conditions * Added Tooltip on filter field to describe how to enter multiple criteria * Forced a minimum Window size Version 2020-04-18 * Added support of Context Menu in Tree View * Added support of Tray * Minimizes on Tray Version 2020-04-12 * Added DPI awareness * Added Enter Key functionality to start a search Version 2020-04-09 * Changed base size of the GUI to make it wider * Made the window resizable * Added Reset button * Shown busy cursor more appropriately * Corrected bug of first line displayed Thanks all for your input. SearchContent.au3
    2 points
  2. I haven't quite hit 1K scripts 😵, but this is still very helpful! If you feel like being fancy, you can even have an option to open the file to the specific line in SciTE. (I have some code somewhere, excuse me while I use this to find it! ) Edit: Found it Edit 2: I really like your use of GUISetCursor to display that it's working! I might move it before _FileListToArrayRec though
    2 points
  3. Velislav

    Simple Google Translate

    Hi, All! I have wanted for a very long time to contribute with something to our community, not only to gain great ideas and examples from all of you guys! Respect for everything you have shared! I don't pretend that this is something great but it works. At least for me. I have made search in this forum and couldn't find a solution so that's why I am sharing this with you: Get's what it is in the clipboard and auto translate it to Bulgarian. You can always change the outcome language. If you have better ideas, or ideas how to improve this code it would be great. #include <IE.au3> $translateText = clipget() $textResault = TranslateFromGGL($translateText,"bg") ConsoleWrite($textResault) Func TranslateFromGGL($sTextToTranslate,$ToLanguageCode) $URL = "https://translate.google.com/?um=1&ie=UTF-8&hl=en&client=tw-ob#view=home&op=translate&sl=auto&tl=" & $ToLanguageCode & "&text=" & $sTextToTranslate Global $oIE = _IECreate($URL, 0, 0, 1) $oTranslated = GetObj("span","class","tlid-translation translation",$oIE) If @error Then $oIE.quit $TranslateFromGGL = "It was not able to translate your request" Exit EndIf Local $html = $oTranslated.innerText If @error Then $TranslateFromGGL = "It was not able to trasnlate your request!" Else $TranslateFromGGL = $html EndIf $oIE.quit Return $TranslateFromGGL EndFunc Func GetObj($Tag, $Attribute, $AttributeValue, $oIE = $oIE) $aTags = _IETagNameGetCollection($oIE, $Tag) For $aTag In $aTags If StringLower($Attribute) = "innertext" Then If StringInStr($aTag.innerText, $AttributeValue) > 0 Then $GetObj = $aTag ExitLoop EndIf ElseIf StringLower($Attribute) = "class" Or StringLower($Attribute) = "classname" Then If StringInStr($aTag.classname, $AttributeValue) > 0 Then $GetObj = $aTag ;MsgBox("","","found" & $aTag.innerText) ExitLoop EndIf Else If StringInStr($aTag.getAttribute($Attribute), $AttributeValue) > 0 Then $GetObj = $aTag ExitLoop EndIf EndIf Next If $GetObj = "" Then Else Return $GetObj EndIf EndFunc ;==>GetObj
    1 point
  4. hi, i am working on windows based login with selenium and java for webUI testing. Locally it's works perfectly but when i run the same script on selenium grid node, it's not working. may be autoIT EXE not executing Selenium Grid node. so, please help me how i can solve it. Code/instruction .. anything. how i can run autoIT Exe on Gridnode from jenkins server or any PC. please help thanks Tanvir
    1 point
  5. Helpfile is your friend
    1 point
  6. It is a 0-base array not a 1-base like you seem to believe. Just use : For $iT = 0 To UBound($UploadArray) - 1
    1 point
  7. New version available. I removed the code, hope you don't mind (only kept the download). I felt it made the post encumbered. Let me know if you prefer having the code, I will add it again.
    1 point
  8. I also use it for other languages, and Scite is not always the editor. I wanted to make it as general as possible. As for the cursor I will implement it also. Thanks.
    1 point
  9. Like Danp2 said, check WinClose's return It looks like you have a space before free, check that. Also, Opt is usually used once at the top of your script. It sets that option until it is changed by another Opt line, or the script ends. And this is nitpicking, but "My brain hurts!": Why are you using 30,000 * 5? I'm sure you know what that is multiplied out, and if you're going to use multiplication in your script like that, at least have it make sense... like displaying it in minutes: 2.5 * (60 * 1000)
    1 point
  10. @svenjatzu, Topics merged and stick to one thread per topic please! Jos
    1 point
  11. Untouch but adding the new search basic method by restarting script and modifying the $ARRAY_OF_FOLDERS = [@scriptdir, @MyDocumentsDir] Nice work... #include <Constants.au3> #include <GUIConstants.au3> #include <GuiTreeView.au3> #include <File.au3> Opt("MustDeclareVars", 1) Const $ARRAY_OF_FOLDERS = [@scriptdir, @MyDocumentsDir] Const $DEFAULT_FILTER = "*.au3" Local $hGUI = GUICreate("Search Content", 600, 440, 190, 120) GUISetFont(11) Local $idSelect = GUICtrlCreateButton("Select Folder", 25, 20, 135, 30) Local $idFolder = GUICtrlCreateCombo("", 185, 24, 400, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlCreateLabel("Filter :", 25, 58, 50, 25) Local $idFilter = GUICtrlCreateInput($DEFAULT_FILTER, 70, 55, 90, 25) GUICtrlCreateLabel("Text to search :", 185, 58, 100, 25) Local $idText = GUICtrlCreateInput("", 285, 55, 300, 25) Local $idTreeFile = GUICtrlCreateTreeView(25, 90, 560, 300) GUICtrlSetFont(-1, 9) Local $idSearch = GUICtrlCreateButton("Search", 100, 400, 100, 25) Local $idOpen = GUICtrlCreateButton("Open", 400, 400, 100, 25) local $idNewSearch = GUICtrlCreateButton("New Search", 230, 400, 150, 25) GUISetState(@SW_SHOW) Local $sFolder, $idTVselect, $aSelect[1], $idParent GUICtrlSetData($idFolder, _ArrayToString($ARRAY_OF_FOLDERS), $ARRAY_OF_FOLDERS[0]) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idSelect $sFolder = FileSelectFolder("Select root folder", @ScriptDir, 0, @ScriptDir, $hGUI) If @error Then ContinueLoop GUICtrlSetData($idFolder, $sFolder, $sFolder) Case $idSearch If Not GUICtrlRead($idFolder) Or Not GUICtrlRead($idFilter) Then MsgBox($MB_SYSTEMMODAL, "Error", "You must provide folder and filter fields") ContinueLoop EndIf ReDim $aSelect[1] $aSelect[0] = 0 SearchText($idTreeFile, GUICtrlRead($idFolder), GUICtrlRead($idFilter), GUICtrlRead($idText)) Case $idOpen $idTVselect = GUICtrlRead($idTreeFile) If Not $idTVselect Or _GUICtrlTreeView_GetParentHandle($idTreeFile, $idTVselect) Then MsgBox($MB_SYSTEMMODAL, "Error", "Please select file you want to open") ContinueLoop EndIf OpenFile(GUICtrlRead($idTreeFile, $GUI_READ_EXTENDED), GUICtrlRead($idText)) Case $idNewSearch _RestartProgram() EndSwitch $idTVselect = GUICtrlRead($idTreeFile) If $idTVselect Then If _GUICtrlTreeView_GetParentHandle($idTreeFile, $idTVselect) Then ContinueLoop For $i = 1 To $aSelect[0] If $idTVselect = $aSelect[$i] Then ContinueLoop 2 Next _ArrayAdd($aSelect, $idTVselect) $aSelect[0] += 1 DisplayLine($hGUI, $idTreeFile, $idTVselect, ControlTreeView($hGUI, "", $idTreeFile, "GetSelected"), GUICtrlRead($idText)) EndIf WEnd Func SearchText($idTree, $sFolder, $sFilter, $sText) Local Const $CURSOR_WAIT = 15 Local $bFound = False _GUICtrlTreeView_DeleteAll($idTree) Local $aFile = _FileListToArrayRec($sFolder, $sFilter, $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) If @error Then Return MsgBox($MB_SYSTEMMODAL, "Error", "No file selected") GUISetCursor($CURSOR_WAIT, $GUI_CURSOR_OVERRIDE) For $i = 1 To $aFile[0] If Not $sText Or StringInStr(FileRead($aFile[$i]), $sText) Then GUICtrlCreateTreeViewItem($aFile[$i], $idTree) $bFound = True EndIf Next GUISetCursor() If Not $bFound Then MsgBox($MB_SYSTEMMODAL, "Error", "Text not found") EndFunc ;==>SearchText Func DisplayLine($hGUI, $idTree, $idItem, $sItem, $sText) If Not $sText Then Return Local $aLine = FileReadToArray($sItem) For $i = 1 To UBound($aLine) - 1 If StringInStr($aLine[$i], $sText) Then GUICtrlCreateTreeViewItem($aLine[$i], $idItem) Next ControlTreeView($hGUI, "", $idTree, "Expand", $sItem) EndFunc ;==>DisplayLine Func OpenFile($sFile, $sText) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFile, $sDrive, $sDir, $sFileName, $sExtension) ClipPut($sText) ShellExecute($sFile, "", $sDrive & $sDir, "open") EndFunc ;==>OpenFile #Region --- Restart Program --- Func _RestartProgram() If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc; ==> _RestartProgram #EndRegion --- Restart Program ---
    1 point
  12. I read something that said that not every PivotTable is available from the workbook level for some reason, so my only thought is to specify the Worksheet that the PivotTable is specified on. Try this: (filling it in of course ) #include <Excel.au3> Global $aArray[] = ["[Report 2].[Week].&[10]", "[Report 2].[Week].&[11]", _ "[Report 2].[Week].&[12]", "[Report 2].[Week].&[13]", _ "[Report 2].[Week].&[14]", "[Report 2].[Week].&[15]"] Global $oExcel = _Excel_Open() If @error Then Exit ConsoleWrite("_Excel_Open()" & @CRLF) Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Users\....\Orders.xlsb") If @error Then Exit ConsoleWrite("_Excel_BookOpen()" & @CRLF) Global $oSheet = $oWorkbook.Sheets("YourSheetName") If @error Then Exit ConsoleWrite("$oWorkbook.Sheets" & @CRLF) $oWorksheet.PivotTables("PivotTable1").PivotFields("[Report 2].[Week].[Week]").VisibleItemsList = $aArray
    1 point
  13. It talks about WinTitleMatchMode on the page that I referenced in my original post. As a matter of fact, it's on the first line of the page and the part right below that shows the different modes. Obviously you didn't read it. I not wasting anymore of my time.
    1 point
  14. Array is a VBA function. I think you need to provide an array when using AutoIt. Untested: #include <Excel.au3> Global $aArray[] = ["[Report 2].[Week].&[10]", "[Report 2].[Week].&[11]", _ "[Report 2].[Week].&[12]", "[Report 2].[Week].&[13]", _ "[Report 2].[Week].&[14]", "[Report 2].[Week].&[15]"] Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, "C:\Users\....\Orders.xlsb") $oWorkbook.PivotTables("PivotTable1").PivotFields("[Report 2].[Week].[Week]").VisibleItemsList = $aArray
    1 point
  15. Sers, while working on another project I was in need of desktop notifications. I wanted an own implementation and from time to time the code grew and I thought about sharing it with the world. I know that there is a similar UDF out there but when my project got bigger an UDF was the best choice for me. As you can see the UDF's differ in usage and style of notifications. So, what do we have? The UDF offers the usage of permanent desktop notifications for your own script in a very easy way. Notifications are starting in the bottom right corner of your main screen and will be shown on top until there is no more space. Further notifications will be shown if previous ones are closed. The notifications have a nice minimalistic design in two colors. By default they match the look of the dark taskbar in Windows 10, but colors and other things can be set differently if wished (see example scripts). The UDF works for GUIOnEventMode activated and deactivated and detects it automatically. Show me! Each notification has its GUI, a title, the message, a seperating line, date label, time label and a closing button (and if activated, a border around the notification). The color of the title, message, seperating line, date, time and closing button (+ border if activated) have all the text color. Right now notifications have a fixed size. I thought about variable sizes but did not add it because I didn't need it so far. Some people may notice the shorter seperating line when border is activated, thats just because of better looks Notifications will be colored as the following: Windows 10: they match the design of the taskbar Windows 8/8.1: On most designs: they match the border color of active windows, else they are black with transparency (see screenshot) Windows 7 and earlier: black with transparency (sry aero) How do I use notifications in my script? include UDF call _Notifications_Startup() (after you determined if you want to use GUIOnEventMode or not) If GUIOneventMode deactivated: call _Notifications_CheckGUIMsg($__GUIMsg) in your main loop create a notification using _Notifications_Create($__title, $__message) Between step 2 and 3 you can set various options: _Notifications_SetAnimationTime _Notifications_SetBorder _Notifications_SetButtonText _Notifications_SetBkColor _Notifications_SetColor _Notifications_SetDateFormat _Notifications_SetSound _Notifications_SetTextAlign _Notifications_SetTimeFormat _Notifications_SetTransparency You can also set own functions to be called when notifications are clicked (see advanced example). And now? You can find more information in the UDF. There also are two example scripts to show the usage for GUIOnEventMode activated and deactivated. Another advanced example shows the usage of the Set-Functions. Thats it? Yup, have fun. Changelog Notifications.au3 ( v1.2) Notifications GUIMsg Example.au3 Notifications OnEvent Example.au3 Notifications Advanced Example.au3
    1 point
  16. Code to execute AutoIt case "fileName": process = Process.Start(@"E:\graderDocs\graderWord_0_score\word0.exe"); break; AutoIT script WinWaitActive("Open") Send("C:\graderDocs\graderExcel_22.5_score\Last_First_sk16_xl_ch1-4_grader_cap_hw.xlsx") Send("{ENTER}") Its working fine in my machine & Friends machine.Only while executing in selenium grid its failing. Thanks, Parth
    1 point
  17. seangriffin

    Chrome UDF

    Yes, it might seem odd that the registry value is escaped, though it must be this way or the native messaging host won't start. That's my experience. Here's more information to help in troubleshooting. Thanks for spending the time on this. Might help others too. To confirm the native messaging host is starting with Chrome as expected, I would first try starting Chrome on it's own, without loading any pages or using the UDF. Then go to Windows Task Manager and you should see the a process named autoit-chrome-native-messaging-host.exe. This will confirm that the registry value above is set correctly, as this points Chrome to the location of the Native Messaging Host such that it can start it when Chrome starts.. If autoit-chrome-native-messaging-host.exe isn't running when you start Chrome then get the value of the registry key above, and in Windows Explorer go to this location (i.e. C:UsersJOHNAppDataRoamingAutoIt3Chrome Native Messaging Host). Check the file autoit-chrome-native-messaging-host.exe and manifest.json exist. Open manifest.json in Notepad. Make sure "path" is set to the full path of autoit-chrome-native-messaging-host.exe, and the path includes double-backslashes. Also make sure the value for "allowed_origins"opmlbgppkkdeleedejakphgmgiigjjga/) matches the value in the ID field of the Chrome Extension. Check this by opening Chrome and go to the Tools -> Extensions menu item. In the Extensions page make sure Developer mode is ticked, and then locate the ID field for the AutoIT for Chrome extension. This value should match the value for "allowed_origins" in the manifest.json file. If the settings above are correct, then every time you start Chrome, irrespective of whether you are using AutoIT or not, you should also have the autoit-chrome-native-messaging-host.exe process running. The next step is to confirm if the AutoIT UDF is talking properly to the Native Messaging Host (autoit-chrome-native-messaging-host.exe). Run an AutoIT script that uses the UDF (Chrome.au3), like one of the Examples from the top post. When a function in the UDF is called, it should create a file named input.txt in the same location as autoit-chrome-native-messaging-host.exe (i.e. C:UsersJOHNAppDataRoamingAutoIt3Chrome Native Messaging Hostinput.txt). This file should contain some Javascript relating to the UDF function called (i.e. document.getElementsByName('ExampleForm')[0].method;). If Chrome and the Native Messaging Host (autoit-chrome-native-messaging-host.exe) are running, then the Native Messaging Host should immediately detect this file (i.e. C:UsersJOHNAppDataRoamingAutoIt3Chrome Native Messaging Hostinput.txt) whenever it's created, read it's contents and remove the file. The Native Messaging Host is so fast at doing this that you may not even see the existence of input.txt. Try running a UDF function without Chrome running and make sure input.txt is created. If input.txt is successfully created, then autoit-chrome-native-messaging-host.exe should automatically consume it (as described above), pass the Javascript onto the Chrome Extension, which uses it in Chrome and sends a response back to autoit-chrome-native-messaging-host.exe which should in turn create an output.txt file in the same location as input.txt. The Chrome UDF then detects this file, reads in the response, and the UDF function completes.
    1 point
  18. seangriffin

    Chrome UDF

    Hmmm, odd that something is uploading. There certainly isn't anything in this solution that uploads or downloads. Here's a description of exactly what the 3 components to the UDF do (in case anyone was wondering): The Chrome UDF - is an AutoIT UDF that sends requests to the Native Messaging Host (below), via a text file, and waits for a response from the Native Messaging Host (below), via a text file. The Native Messaging Host - is a Python application that listens for requests from the AutoIT UDF (above), via a text file, and forwards those requests onto the Chrome Extension (below). It also listens for output from the Chrome Extension (below) and forwards that back to the AutoIT UDF (above), via a text file. The Chrome Extension - is a collection of Javascript files that wait for a request from the Native Message Host (above), and then injects that request (Javascript) into the page within Chrome to interact with the elements in that page. The response from this request is then sent back to the Native Message Host (above). All these components communicate to each other through a combination of text files and stdio. There are no HTTP requests involved, and as such I wouldn't expect any uploads or downloads to occur through the UDF. Try Example #2 because it works "offline". It should work without an internet connection, and that will eliminate any uploading or downloading going on.
    1 point
  19. Where mistake UpdatDresources #Include <WinAPI.au3> ;http://msdn2.microsoft.com/en-us/library/ms648008(VS.85).aspx ;The following example copies a dialog box resource from one executable file, Hand.exe, to another, Foot.exe, by following these steps: ;Use the LoadLibrary function to load the executable file Hand.exe. ;Use the FindResource and LoadResource functions to locate and load the dialog box resource. ;Use the LockResource function to retrieve a pointer to the dialog box resource data. ;Use the BeginUpdateResource function to open an update handle to Foot.exe. ;Use the UpdateResource function to copy the dialog box resource from Hand.exe to Foot.exe. ;Use the EndUpdateResource function to complete the update. ;The following code implements these steps. Global Const $RT_CURSOR = 1 Global Const $RT_BITMAP = 2 Global Const $RT_ICON = 3 Global Const $RT_MENU = 4 Global Const $RT_DIALOG = 5 Global Const $RT_STRING = 6 Global Const $RT_FONTDIR = 7 Global Const $RT_FONT = 8 Global Const $RT_ACCELERATORS = 9 Global Const $RT_RCDATA = 10 Global Const $RT_MESSAGETABLE = 11 Global Const $RT_GROUP_CURSOR = 12 Global Const $RT_GROUP_ICON = 14 Global Const $RT_VERSION = 16 Global Const $RT_ANICURSOR = 21 Global Const $RT_ANIICON = 22 Global Const $RT_HTML = 23 Global Const $RT_MANIFEST = 24 Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_SYNC = 0x0 Global Const $SND_ASYNC = 0x1 Global Const $SND_LOOP = 0x8 Global Const $SND_NOSTOP = 0x10 Global Const $SND_NOWAIT = 0x2000 Global Const $SND_PURGE = 0x40 Func Process_Updating_Resources($pFileName = "Hand.exe" _ ,$pFileNameUpdat = "Foot.exe" _ ,$ResName = "Dialog" _ , $ResType = $RT_DIALOG _ ,$LANG_NEUTRAL = 0409 _;English_United_States ,$SUBLANG_NEUTRAL = 0409);English_United_States ;Load the .EXE file that contains the dialog box you want to copy. $hExe = _WinAPI_LoadLibrary($pFileName) if ($hExe = 0) Then MsgBox(0,"LoadLibrary", "Could not load exe.") Return 0 ENDIF ;Locate the dialog box resource in the .EXE file. $hRes = FindResource($hExe, $ResName, $ResType) if @error then MsgBox(0,"FindResource", "Could not locate dialog box.") Return 0 ENDIF ;Load the dialog box into global memory. $hResLoad = LoadResource($hExe, $hRes) if @error then MsgBox(0,"LoadResource", "Could not load dialog box.") Return 0 ENDIF ;Lock the dialog box into global memory. $lpResLock = LockResource($hResLoad) if @error Then MsgBox(0,"LockResource", "Could not lock dialog box .") Return 0 ENDIF ;Open the file to which you want to add the dialog box resource. $hUpdateRes = BeginUpdateResource($pFileNameUpdat, False) if @error then MsgBox(0,"BeginUpdateResource", "Could not open file for writing.") Return 0 ENDIF $MAKELANGID = _WinAPI_MAKELANGID($LANG_NEUTRAL, $SUBLANG_NEUTRAL) ;Add the dialog box resource to the update list. $result = UpdateResource($hUpdateRes, _;update resource handle $ResType, _ ;change dialog box resource $ResName, _ ;dialog box name $MAKELANGID, _ ;neutral language $lpResLock, _ ;ptr to resource info SizeofResource($hExe, $hRes)); // size of resource info. if ($result == FALSE) then MsgBox(0,"UpdateResource", "Could not add resource.") Return 0 ENDIF ;Write changes to FOOT.EXE and then close it. if (EndUpdateResource($hUpdateRes,True)) Then MsgBox(0,"EndUpdateResource", "Could not End Update Resource.") ENDIF ;Clean up. if Not (_WinAPI_FreeLibrary($hExe)) Then MsgBox(0,"FreeLibrary", "Could not free executable.") Return 0 ELSE Return 1 ENDIF EndFunc Func FindResource($hModule , _ $lpName , _ $lpType) ;http://msdn2.microsoft.com/en-us/library/ms648042(VS.85).aspx $Callresult = DllCall("kernel32.dll" ,"int", "FindResourceA", "hwnd", $hModule, "str", $lpName _ ,"long", $lpType) MsgBox(0,"FindResourceA", _WinAPI_GetLastErrorMessage()) Return $Callresult[0] EndFunc Func LoadResource($hModule, _ $hResInfo) ;http://msdn2.microsoft.com/en-us/library/ms648046(VS.85).aspx $Callresult = DllCall("kernel32.dll", "int", "LoadResource", "int", $hModule, "int", $hResInfo) MsgBox(0,"LoadResource", _WinAPI_GetLastErrorMessage()) Return $Callresult[0] EndFunc Func LockResource($hResData) ;http://msdn2.microsoft.com/en-us/library/ms648047(VS.85).aspx $Callresult = DllCall("kernel32.dll", "int", "LockResource", "int", $hResData) MsgBox(0,"LockResource", _WinAPI_GetLastErrorMessage()) Return $Callresult[0] EndFunc Func SizeofResource($hModule, _ $hResInfo) ;http://msdn2.microsoft.com/en-us/library/ms648048(VS.85).aspx $Callresult = DllCall("kernel32.dll", "dword", "SizeofResource", "int", $hModule, "int", $hResInfo) MsgBox(0,"SizeofResource", _WinAPI_GetLastErrorMessage()) Return $Callresult[0] EndFunc Func BeginUpdateResource($pFileName , _ $bDeleteExistingResources) ;http://msdn2.microsoft.com/en-us/library/ms648030(VS.85).aspx $Callresult = DllCall("kernel32.dll", "int", "BeginUpdateResource", "str", $pFileName, "int", _ $bDeleteExistingResources) Return $Callresult[0] EndFunc Func UpdateResource($hUpdate, _ $lpType, _ $lpName, _ $wLanguage, _ $lpData, _ $cbData ) ;http://msdn2.microsoft.com/en-us/library/ms648049(VS.85).aspx $Callresult = DllCall("kernel32.dll", "int", "UpdateResource","hwnd",$hUpdate, "str", $lpType, "str", $lpName _ ,"short",$wLanguage,"prt",$lpData,"DWORD",$cbData) MsgBox(0,"UpdateResource", _WinAPI_GetLastErrorMessage()) Return $Callresult EndFunc Func EndUpdateResource($hUpdate, _ $fDiscard) ;http://msdn2.microsoft.com/en-us/library/ms648032(VS.85).aspx $Callresult = DllCall("kernel32.dll", "int", "EndUpdateResource","hwnd",$hUpdate,"int",$fDiscard) MsgBox(0,"EndUpdateResource", _WinAPI_GetLastErrorMessage()) Return $Callresult[0] EndFunc Hand.exe #AutoIt3Wrapper_useupx=n #AutoIt3Wrapper_run_after="AddRes.exe "%out%"" #include <GUIConstants.au3> #Include "resources.au3" $TXT = _ResourceGetAsString("AboutBox", $RT_RCDATA,0) $TXT = StringSplit($TXT,@CRLF) $Form1 = GUICreate("AboutBox Hand.exe", 324, 234, 210, 161) $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185) $Image1 = GUICtrlCreatePic("", 16, 24, 105, 97) $Label1 = GUICtrlCreateLabel("Product Name", 152, 24, 72, 17, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Version " & $TXT[3], 152, 48, 300, 17, $WS_GROUP) $Label4 = GUICtrlCreateLabel("Comments", 16, 160, 53, 17, $WS_GROUP) $Label3 = GUICtrlCreateLabel("Copyright " & $TXT[1], 16, 136, 300, 17, $WS_GROUP) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button2 = GUICtrlCreateButton("Chk_Update",152, 100, 75, 25 ) $Button1 = GUICtrlCreateButton("&ok", 112, 208, 75, 25) GUISetState(@SW_SHOW) _ResourceSetImageToCtrl($Image1, "AboutBoximage", 2) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE OR $nMsg = $Button1 Exit Case $nMsg = $Button2 MsgBox(0,"Hand.exe","thes Box For Hand.exe" & @CRLF & "Version 1.1.1.0" _ & @CRLF & "Copyright Wolf Microsoft" ) EndSelect WEnd TXTBox.txt ===> Hand.exe Wolf Microsoft 1.1.1.0 Foot.exe #AutoIt3Wrapper_useupx=n #AutoIt3Wrapper_run_after="AddRes.exe "%out%"" #include <GUIConstants.au3> #Include "resources.au3" $TXT = _ResourceGetAsString("AboutBox", $RT_RCDATA,0) $TXT = StringSplit($TXT,@CRLF) $Form1 = GUICreate("AboutBox Foot.exe", 324, 234, 210, 161) $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 185) $Image1 = GUICtrlCreatePic("", 16, 24, 105, 97) $Label1 = GUICtrlCreateLabel("Product Name", 152, 24, 72, 17, $WS_GROUP) $Label2 = GUICtrlCreateLabel("Version " & $TXT[3], 152, 48, 300, 17, $WS_GROUP) $Label4 = GUICtrlCreateLabel("Comments", 16, 160, 53, 17, $WS_GROUP) $Label3 = GUICtrlCreateLabel("Copyright " & $TXT[1], 16, 136, 300, 17, $WS_GROUP) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button2 = GUICtrlCreateButton("Chk_Update",152, 100, 75, 25 ) $Button1 = GUICtrlCreateButton("&ok", 112, 208, 75, 25) GUISetState(@SW_SHOW) _ResourceSetImageToCtrl($Image1, "AboutBoximage", 2) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE OR $nMsg = $Button1 Exit Case $nMsg = $Button2 MsgBox(0,"Foot.exe","thes Box For Foot.exe" & @CRLF & "Version 0.0.0.0" _ & @CRLF & "Copyright Bill Microsoft" ) EndSelect WEnd TXTBox.txt ===> Foot.exe Bill Microsoft 0.0.0.0 AddRes.exe $ResName = "AboutBox" $ResType = "RCDATA" $COMMAND = "ResHacker.exe -addoverwrite AU3.EXE, AU3.EXE, TXTBox.TXT," & $ResType & ", " & $ResName & ", 0" IF Run($COMMAND ,"",@SW_HIDE) THEN _ MsgBox(0,"err", "AddRes.exe Done1") $ResName = "AboutBoximage" $ResType = "BITMAP" $COMMAND = "ResHacker.exe -addoverwrite AU3.EXE, AU3.EXE, AboutBoxImage.bmp," & $ResType & ", " & $ResName & ", 0" IF Run($COMMAND ,"",@SW_HIDE) THEN _ MsgBox(0,"err", "AddRes.exe Done2") STARTUpdatDresources #include "UpdatDresources.AU3" Global $pFileName = @ScriptDir & "\Wolf\Hand.exe" Global $pFileNameUpdat = @ScriptDir & "\Bill\Foot.exe" FileCopy($pFileNameUpdat, @ScriptDir & "\UpdatFoot.exe",1) FileCopy($pFileName, @ScriptDir & "\Hand.exe",1) Sleep(3000) Global $pFileNameUpdat = "UpdatFoot.exe" Global $pFileName = "Hand.exe" Process_Updating_Resources($pFileName _ ,$pFileNameUpdat _ ,"AboutBox" _ ,$RT_RCDATA _ ,0409 _ ,0409) UpdatRes.zip http://www.2shared.com/file/2997750/7387c7ce/UpdatRes.html
    1 point
  20. All the files on this link http://www.2shared.com/file/3032894/2f15b909/Res_Update.html Res_Update.au3 #include-once #Include <WinAPI.au3> Global Const $Afrikaans = 1078 Global Const $Albanian = 1052 Global Const $Arabic_Algeria = 5121 Global Const $Arabic_Bahrain = 15361 Global Const $Arabic_Egypt = 3073 Global Const $Arabic_Iraq = 2049 Global Const $Arabic_Jordan = 11265 Global Const $Arabic_Kuwait = 13313 Global Const $Arabic_Lebanon = 12289 Global Const $Arabic_Libya = 4097 Global Const $Arabic_Morocco = 6145 Global Const $Arabic_Oman = 8193 Global Const $Arabic_Qatar = 16385 Global Const $Arabic_Saudi_Arabia = 1025 Global Const $Arabic_Syria = 10241 Global Const $Arabic_Tunisia = 7169 Global Const $Arabic_U_A_E = 14337 Global Const $Arabic_Yemen = 9217 Global Const $Basque = 1069 Global Const $Belarusian = 1059 Global Const $Bulgarian = 1026 Global Const $Catalan = 1027 Global Const $Chinese_Hong_Kong_SAR = 3076 Global Const $Chinese_PRC = 2052 Global Const $Chinese_Singapore = 4100 Global Const $Chinese_Taiwan = 1028 Global Const $Croatian = 1050 Global Const $Czech = 1029 Global Const $Danish = 1030 Global Const $Dutch = 1043 Global Const $Dutch_Belgium = 2067 Global Const $English_Australia = 3081 Global Const $English_Belize = 10249 Global Const $English_Canada = 4105 Global Const $English_Ireland = 6153 Global Const $English_Jamaica = 8201 Global Const $English_New_Zealand = 5129 Global Const $English_South_Africa = 7177 Global Const $English_Trinidad = 11273 Global Const $English_United_Kingdom = 2057 Global Const $English_United_States = 1033 Global Const $Estonian = 1061 Global Const $Faeroese = 1080 Global Const $Farsi = 1065 Global Const $Finnish = 1035 Global Const $French_Standard = 1036 Global Const $French_Belgium = 2060 Global Const $French_Canada = 3084 Global Const $French_Luxembourg = 5132 Global Const $French_Switzerland = 4108 Global Const $Gaelic_Scotland = 1084 Global Const $German_Standard = 1031 Global Const $German_Austrian = 3079 Global Const $German_Liechtenstein = 5127 Global Const $German_Luxembourg = 4103 Global Const $German_Switzerland = 2055 Global Const $Greek = 1032 Global Const $Hebrew = 1037 Global Const $Hindi = 1081 Global Const $Hungarian = 1038 Global Const $Icelandic = 1039 Global Const $Indonesian = 1057 Global Const $Italian_Standard = 1040 Global Const $Italian_Switzerland = 2064 Global Const $Japanese = 1041 Global Const $Korean = 1042 Global Const $Latvian = 1062 Global Const $Lithuanian = 1063 Global Const $Macedonian_FYROM = 1071 Global Const $Malay_Malaysia = 1086 Global Const $Maltese = 1082 Global Const $Norwegian_Bokml = 1044 Global Const $Polish = 1045 Global Const $Portuguese_Brazil = 1046 Global Const $Portuguese_Portugal = 2070 Global Const $Raeto_Romance = 1047 Global Const $Romanian = 1048 Global Const $Romanian_Moldova = 2072 Global Const $Russian = 1049 Global Const $Russian_Moldova = 2073 Global Const $Serbian_Cyrillic = 3098 Global Const $Setsuana = 1074 Global Const $Slovak = 1051 Global Const $Slovenian = 1060 Global Const $Sorbian = 1070 Global Const $Spanish_Argentina = 11274 Global Const $Spanish_Bolivia = 16394 Global Const $Spanish_Chile = 13322 Global Const $Spanish_Columbia = 9226 Global Const $Spanish_Costa_Rica = 5130 Global Const $Spanish_Dominican_Republic = 7178 Global Const $Spanish_Ecuador = 12298 Global Const $Spanish_El_Salvador = 17418 Global Const $Spanish_Guatemala = 4106 Global Const $Spanish_Honduras = 18442 Global Const $Spanish_Mexico = 2058 Global Const $Spanish_Nicaragua = 19466 Global Const $Spanish_Panama = 6154 Global Const $Spanish_Paraguay = 15370 Global Const $Spanish_Peru = 10250 Global Const $Spanish_Puerto_Rico = 20490 Global Const $Spanish_Spain = 1034 Global Const $Spanish_Uruguay = 14346 Global Const $Spanish_Venezuela = 8202 Global Const $Sutu = 1072 Global Const $Swedish = 1053 Global Const $Swedish_Finland = 2077 Global Const $Thai = 1054 Global Const $Turkish = 1055 Global Const $Tsonga = 1073 Global Const $Ukranian = 1058 Global Const $Urdu_Pakistan = 1056 Global Const $Vietnamese = 1066 Global Const $Xhosa = 1076 Global Const $Yiddish = 1085 Global Const $Zulu = 1077 Global Const $RT_CURSOR = 1 Global Const $RT_BITMAP = 2 Global Const $RT_ICON = 3 Global Const $RT_MENU = 4 Global Const $RT_DIALOG = 5 Global Const $RT_STRING = 6 Global Const $RT_FONTDIR = 7 Global Const $RT_FONT = 8 Global Const $RT_ACCELERATORS = 9 Global Const $RT_RCDATA = 10 Global Const $RT_MESSAGETABLE = 11 Global Const $RT_GROUP_CURSOR = 12 Global Const $RT_GROUP_ICON = 14 Global Const $RT_VERSION = 16 Global Const $RT_ANICURSOR = 21 Global Const $RT_ANIICON = 22 Global Const $RT_HTML = 23 Global Const $RT_MANIFEST = 24 Global Const $SND_RESOURCE = 0x00040004 Global Const $SND_SYNC = 0x0 Global Const $SND_ASYNC = 0x1 Global Const $SND_LOOP = 0x8 Global Const $SND_NOSTOP = 0x10 Global Const $SND_NOWAIT = 0x2000 Global Const $SND_PURGE = 0x40 FileCopy(@ScriptDir & "\original\msgbox.exe" , @ScriptDir & "\AUTOIT.EXE",1) _UpdateResource() FileCopy(@ScriptDir & "\original\TapEditor.exe" , @ScriptDir & "\C++.exe",1) _UpdateResource("C++.exe") Func _UpdateResource($sFile = "AUTOIT.EXE",$lpType = $RT_RCDATA ,$lpName = "DATA_1", _ $wLanguage = $English_United_Kingdom,$bDiscard = False,$InpResFile = "TXT.TXT") $hUpdate = _BeginUpdateResource($sFile) Local $result, $hFile, $tSize, $tBuffer, $pBuffer,$bread = 0 Select Case $lpType = 10 OR $lpType = 16 OR $lpType = 24;RT_RCDATA, RT_VERSION and RT_MANIFEST $hFile = _WinAPI_CreateFile($InpResFile, 2, 2) IF @error THEN Return 0 $tSize = FileGetSize($InpResFile) IF @error THEN Return 0 $tBuffer = DllStructCreate("char Text[" & $tSize & "]") IF @error THEN Return 0 $pBuffer = DllStructGetPtr($tBuffer) IF @error THEN Return 0 _WinAPI_ReadFile($hFile, $pBuffer, FileGetSize($InpResFile), $bread, 0) IF @error THEN Return 0 _WinAPI_CloseHandle($hFile) IF @error THEN Return 0 $result = DllCall("kernel32.dll","int","UpdateResource", _ "hwnd",$hUpdate, _ "long",$lpType, _ "str",$lpName, _ "short",$wLanguage, _ "ptr",$pBuffer, _ "DWORD",$tSize) IF @error THEN Return 0 Else _EndUpdateResource($hUpdate,$bDiscard) Return 1 EndIf EndSelect EndFunc Func _BeginUpdateResource($sFile) $aReturn = DllCall("kernel32.dll","int","BeginUpdateResource","str",$sFile,"int",False) Return $aReturn[0] EndFunc Func _EndUpdateResource($hResource,$bDiscard = 0) $result = DllCall("kernel32.dll", "int", "EndUpdateResource", "int", $hResource, "int", $bDiscard) EndFunc AUTOIT.EXE When opening the file shows the letter C++.EXE the file open without errors
    1 point
×
×
  • Create New...