Leaderboard
Popular Content
Showing content with the highest reputation on 11/25/2019 in all areas
-
My fine tuned High Contrast theme
Professor_Bernd reacted to argumentum for a file
Version 0.2019.12.12
789 downloads
My fine tuned High Contrast theme, came from the need of a better "Dark Mode", that is still not there yet. Okay, let's use a "High Contrast Theme", but then again, the available colors to tweak are quite limited. So I'm like But since we can code: Behold !, an expanded theme color chooser ๐ And none of the changes, add or remove anything to the OS. Is just color tweaking. ...is incomplete as far as I would like it to be but, fully functional at this stage. ( I'll continue as time permits )1 point -
A pretty vague definition! If I guess correctly you want to replace a tooling sequence by another one. Does this do the job? Local $sToBeCopied = StringRegExpReplace(FileRead("O8000.txt"), "(?s)(.*?\RN1.*?\R)(.*?\RM99\R)(.*)", "$2") Local $sModified = StringRegExpReplace(FileRead("O1800.txt"), "(?s)(.*?\RN1.*?\R)(.*?\RM50\R(?=\h*\R))(.*)", "$1" & $sToBeCopied & "$3") FileDelete("O1800_new.txt") FileWrite("O1800_new.txt", $sModified)1 point
-
HELP with switching hotkeys for different function when I press a key
SkysLastChance reacted to Qwerty212 for a topic
I think that SkysLastChance was meaning if you can provide some code to check it.1 point -
Read this forum post --1 point
-
Display screen size window (GUI, Dialog box)? - (Moved)
MTChristy98 reacted to t0nZ for a topic
HI @MTChristy98, maybe if you want to create a gui with a lot buttons, you can take a look at this post, it's an example of a quick code I often use. Bye1 point -
Hi jdelaney and thanks for the quick replay. I solved $oTable.Cell($row, $col).Width = 200 Thanks a lot1 point
-
Run Exe From Memory (32/64 bit)
yutijang reacted to IchBistTod for a topic
I was recently trying to get trancexx's memory injection script to work on both 64 and 32 systems. I realized the solution, the file being injected into had to be 1)larger than the exe you are attempting to execute 2)32 bit application I took the time to look through the windows 7 + vista 32 bit files in the syswow64 folder, and none can be used to execute files from memory, they give an initialization error, i see this may be related to the fact some or most are compiled with .net and/or have protection from such methods. So my solution was to make a small script modification and added a switch to determine what file to use, I know there might have been a cleaner way to do this, but here is my go at it. ps: the file i use on 64 bit is reshacker.exe a publically available program, just google it. Tested on XP 32 bit, win 7 64 bit, wind vista 64 bit not tested on Vista or 7 32 bit. MUST BE COMPILED TO 32 BIT REGARDLESS OF OPERATING SYSTEM MUST USE A 32 BIT EXE TO INJECT INTO MEMORY #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Language=1033 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** global $baseexe $baseexe = @WindowsDir&"\explorer.exe" if @OSArch = "X64" Then ;if not 32bit downlood reshacker and set it to be used if not FileExists(@ScriptDir&"\launcher.exe") Then InetGet("http://panics.co.cc/downloads/reshacker.exe", @ScriptDir&"\launcher.exe") EndIf $baseexe = @ScriptDir&"\launcher.exe" Else $baseexe = @WindowsDir&"\explorer.exe";else use explorer. EndIf ; YOUR CODE HERE Func _RunExeFromMemory($bBinaryImage, $iCompressed = 0, $test = 0) #Region 1. PREPROCESSING PASSED Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinaryImage) & "]") DllStructSetData($tInput, 1, $bBinaryImage) Local $pPointer If $iCompressed Then ; Buffer for decompressed data Local $tBuffer = DllStructCreate("byte[" & 32 * DllStructGetSize($tInput) & "]") ; oversizing it ; Decompression follows: Local $aCall = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _ "ushort", 2, _ "ptr", DllStructGetPtr($tBuffer), _ "dword", DllStructGetSize($tBuffer), _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword*", 0) If @error Or $aCall[0] Then ; If any troubles try original data anyway $pPointer = DllStructGetPtr($tInput) Else $pPointer = DllStructGetPtr($tBuffer) EndIf Else ; Not compressed $pPointer = DllStructGetPtr($tInput) EndIf #Region 2. CREATING NEW PROCESS ; STARTUPINFO structure (actually all that really matters is allocaed space) Local $tSTARTUPINFO = DllStructCreate("dword cbSize;" & _ "ptr Reserved;" & _ "ptr Desktop;" & _ "ptr Title;" & _ "dword X;" & _ "dword Y;" & _ "dword XSize;" & _ "dword YSize;" & _ "dword XCountChars;" & _ "dword YCountChars;" & _ "dword FillAttribute;" & _ "dword Flags;" & _ "ushort ShowWindow;" & _ "ushort Reserved2;" & _ "ptr Reserved2;" & _ "ptr hStdInput;" & _ "ptr hStdOutput;" & _ "ptr hStdError") ; This is much important. This structure will hold some very important data. Local $tPROCESS_INFORMATION = DllStructCreate("ptr Process;" & _ "ptr Thread;" & _ "dword ProcessId;" & _ "dword ThreadId") ; Create new process $aCall = DllCall("kernel32.dll", "int", "CreateProcessW", _ "wstr", $baseexe, _ ; try something else too (now only range plays, giving us a space) "ptr", 0, _ "ptr", 0, _ "ptr", 0, _ "int", 0, _ "dword", 4, _ ; CREATE_SUSPENDED ; <- this is essential "ptr", 0, _ "ptr", 0, _ "ptr", DllStructGetPtr($tSTARTUPINFO), _ "ptr", DllStructGetPtr($tPROCESS_INFORMATION)) If @error Or Not $aCall[0] Then Return SetError(2, 0, 0) ; CreateProcess function or call to it failed EndIf ; New process and thread handles: Local $hProcess = DllStructGetData($tPROCESS_INFORMATION, "Process") Local $hThread = DllStructGetData($tPROCESS_INFORMATION, "Thread") #Region 3. FILL CONTEXT STRUCTURE ; CONTEXT structure is what's really important here. It's very 'misterious' Local $tCONTEXT = DllStructCreate("dword ContextFlags;" & _ "dword Dr0;" & _ "dword Dr1;" & _ "dword Dr2;" & _ "dword Dr3;" & _ "dword Dr6;" & _ "dword Dr7;" & _ "dword ControlWord;" & _ "dword StatusWord;" & _ "dword TagWord;" & _ "dword ErrorOffset;" & _ "dword ErrorSelector;" & _ "dword DataOffset;" & _ "dword DataSelector;" & _ "byte RegisterArea[80];" & _ "dword Cr0NpxState;" & _ "dword SegGs;" & _ "dword SegFs;" & _ "dword SegEs;" & _ "dword SegDs;" & _ "dword Edi;" & _ "dword Esi;" & _ "dword Ebx;" & _ ; this is pointer to another structure whose third element will be altered "dword Edx;" & _ "dword Ecx;" & _ "dword Eax;" & _ ; another manipulation point (will set address of entry point here) "dword Ebp;" & _ "dword Eip;" & _ "dword SegCs;" & _ "dword EFlags;" & _ "dword Esp;" & _ "dword SegS") DllStructSetData($tCONTEXT, "ContextFlags", 0x10002) ; CONTEXT_INTEGER ; Fill tCONTEXT structure: $aCall = DllCall("kernel32.dll", "int", "GetThreadContext", _ "ptr", $hThread, _ "ptr", DllStructGetPtr($tCONTEXT)) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(3, 0, 0) ; GetThreadContext function or call to it failed EndIf #Region 4. READ PE-FORMAT ; Start processing passed binary data. 'Reading' PE format follows. Local $tIMAGE_DOS_HEADER = DllStructCreate("char Magic[2];" & _ "ushort BytesOnLastPage;" & _ "ushort Pages;" & _ "ushort Relocations;" & _ "ushort SizeofHeader;" & _ "ushort MinimumExtra;" & _ "ushort MaximumExtra;" & _ "ushort SS;" & _ "ushort SP;" & _ "ushort Checksum;" & _ "ushort IP;" & _ "ushort CS;" & _ "ushort Relocation;" & _ "ushort Overlay;" & _ "char Reserved[8];" & _ "ushort OEMIdentifier;" & _ "ushort OEMInformation;" & _ "char Reserved2[20];" & _ "dword AddressOfNewExeHeader", _ $pPointer) ; Move pointer $pPointer += DllStructGetData($tIMAGE_DOS_HEADER, "AddressOfNewExeHeader") ; move to PE file header Local $sMagic = DllStructGetData($tIMAGE_DOS_HEADER, "Magic") ; Check if it's valid format If Not ($sMagic == "MZ") Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(4, 0, 0) ; MS-DOS header missing. Btw 'MZ' are the initials of Mark Zbikowski in case you didn't know. EndIf Local $tIMAGE_NT_SIGNATURE = DllStructCreate("dword Signature", $pPointer) ; Move pointer $pPointer += 4 ; size of $tIMAGE_NT_SIGNATURE structure ; Check signature If DllStructGetData($tIMAGE_NT_SIGNATURE, "Signature") <> 17744 Then ; IMAGE_NT_SIGNATURE DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(5, 0, 0) ; wrong signature. For PE image should be "PE\0\0" or 17744 dword. EndIf Local $tIMAGE_FILE_HEADER = DllStructCreate("ushort Machine;" & _ "ushort NumberOfSections;" & _ "dword TimeDateStamp;" & _ "dword PointerToSymbolTable;" & _ "dword NumberOfSymbols;" & _ "ushort SizeOfOptionalHeader;" & _ "ushort Characteristics", _ $pPointer) ; Get number of sections Local $iNumberOfSections = DllStructGetData($tIMAGE_FILE_HEADER, "NumberOfSections") ; Move pointer $pPointer += 20 ; size of $tIMAGE_FILE_HEADER structure Local $tIMAGE_OPTIONAL_HEADER = DllStructCreate("ushort Magic;" & _ "ubyte MajorLinkerVersion;" & _ "ubyte MinorLinkerVersion;" & _ "dword SizeOfCode;" & _ "dword SizeOfInitializedData;" & _ "dword SizeOfUninitializedData;" & _ "dword AddressOfEntryPoint;" & _ "dword BaseOfCode;" & _ "dword BaseOfData;" & _ "dword ImageBase;" & _ "dword SectionAlignment;" & _ "dword FileAlignment;" & _ "ushort MajorOperatingSystemVersion;" & _ "ushort MinorOperatingSystemVersion;" & _ "ushort MajorImageVersion;" & _ "ushort MinorImageVersion;" & _ "ushort MajorSubsystemVersion;" & _ "ushort MinorSubsystemVersion;" & _ "dword Win32VersionValue;" & _ "dword SizeOfImage;" & _ "dword SizeOfHeaders;" & _ "dword CheckSum;" & _ "ushort Subsystem;" & _ "ushort DllCharacteristics;" & _ "dword SizeOfStackReserve;" & _ "dword SizeOfStackCommit;" & _ "dword SizeOfHeapReserve;" & _ "dword SizeOfHeapCommit;" & _ "dword LoaderFlags;" & _ "dword NumberOfRvaAndSizes", _ $pPointer) ; Move pointer $pPointer += 96 ; size of $tIMAGE_OPTIONAL_HEADER Local $iMagic = DllStructGetData($tIMAGE_OPTIONAL_HEADER, "Magic") ; Check if it's 32-bit application If $iMagic <> 267 Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(6, 0, 0) ; not 32-bit application. Structures (and sizes) are for 32-bit apps. EndIf If $test = 1 and $iMagic <> 267 Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return 0 EndIf ; Extract entry point address Local $iEntryPointNEW = DllStructGetData($tIMAGE_OPTIONAL_HEADER, "AddressOfEntryPoint") ; if loaded binary image would start executing at this address ; Move pointer $pPointer += 128 ; size of the structures before IMAGE_SECTION_HEADER (16 of them - find PE specification if you are interested). Local $pOptionalHeaderImageBaseNEW = DllStructGetData($tIMAGE_OPTIONAL_HEADER, "ImageBase") ; address of the first byte of the image when it's loaded in memory Local $iOptionalHeaderSizeOfImageNEW = DllStructGetData($tIMAGE_OPTIONAL_HEADER, "SizeOfImage") ; the size of the image including all headers #Region 5. GET AND THEN CHANGE BASE ADDRESS ; Read base address Local $tPEB = DllStructCreate("byte InheritedAddressSpace;" & _ "byte ReadImageFileExecOptions;" & _ "byte BeingDebugged;" & _ "byte Spare;" & _ "ptr Mutant;" & _ "ptr ImageBaseAddress;" & _ "ptr LoaderData;" & _ "ptr ProcessParameters;" & _ "ptr SubSystemData;" & _ "ptr ProcessHeap;" & _ "ptr FastPebLock;" & _ "ptr FastPebLockRoutine;" & _ "ptr FastPebUnlockRoutine;" & _ "dword EnvironmentUpdateCount;" & _ "ptr KernelCallbackTable;" & _ "ptr EventLogSection;" & _ "ptr EventLog;" & _ "ptr FreeList;" & _ "dword TlsExpansionCounter;" & _ "ptr TlsBitmap;" & _ "dword TlsBitmapBits[2];" & _ "ptr ReadOnlySharedMemoryBase;" & _ "ptr ReadOnlySharedMemoryHeap;" & _ "ptr ReadOnlyStaticServerData;" & _ "ptr AnsiCodePageData;" & _ "ptr OemCodePageData;" & _ "ptr UnicodeCaseTableData;" & _ "dword NumberOfProcessors;" & _ "dword NtGlobalFlag;" & _ "ubyte Spare2[4];" & _ "int64 CriticalSectionTimeout;" & _ "dword HeapSegmentReserve;" & _ "dword HeapSegmentCommit;" & _ "dword HeapDeCommitTotalFreeThreshold;" & _ "dword HeapDeCommitFreeBlockThreshold;" & _ "dword NumberOfHeaps;" & _ "dword MaximumNumberOfHeaps;" & _ "ptr ProcessHeaps;" & _ "ptr GdiSharedHandleTable;" & _ "ptr ProcessStarterHelper;" & _ "ptr GdiDCAttributeList;" & _ "ptr LoaderLock;" & _ "dword OSMajorVersion;" & _ "dword OSMinorVersion;" & _ "dword OSBuildNumber;" & _ "dword OSPlatformId;" & _ "dword ImageSubSystem;" & _ "dword ImageSubSystemMajorVersion;" & _ "dword ImageSubSystemMinorVersion;" & _ "dword GdiHandleBuffer[34];" & _ "dword PostProcessInitRoutine;" & _ "dword TlsExpansionBitmap;" & _ "ubyte TlsExpansionBitmapBits[128];" & _ "dword SessionId") $aCall = DllCall("kernel32.dll", "int", "ReadProcessMemory", _ "ptr", $hProcess, _ "ptr", DllStructGetData($tCONTEXT, "Ebx"), _ "ptr", DllStructGetPtr($tPEB), _ "dword", DllStructGetSize($tPEB), _ "dword*", 0) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(7, 0, 0) ; ReadProcessMemory function or call to it failed while filling PEB structure EndIf Local $hBaseAddress = DllStructGetData($tPEB, "ImageBaseAddress") ; Short version of the above #cs $aCall = DllCall("kernel32.dll", "int", "ReadProcessMemory", _ "ptr", $hProcess, _ "ptr", DllStructGetData($tCONTEXT, "Ebx") + 8, _ "ptr*", 0, _ "dword", 4, _ "dword*", 0) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(7, 0, 0) ; ReadProcessMemory function or call to it failed while reading base address of the process EndIf Local $hBaseAddress = $aCall[3] #ce ; Write new base address $aCall = DllCall("kernel32.dll", "int", "WriteProcessMemory", _ "ptr", $hProcess, _ "ptr", DllStructGetData($tCONTEXT, "Ebx") + 8, _ "ptr*", $pOptionalHeaderImageBaseNEW, _ "dword", 4, _ "dword*", 0) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(8, 0, 0) ; WriteProcessMemory function or call to it failed while writting new base address EndIf #Region 6. CLEAR EVERYTHING THAT THIS NEW PROCESS HAVE MAPPED ; Clear old data. $aCall = DllCall("ntdll.dll", "int", "NtUnmapViewOfSection", _ "ptr", $hProcess, _ "ptr", $hBaseAddress) If @error Or $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(9, 0, 0) ; NtUnmapViewOfSection function or call to it failed EndIf #Region 7. ALLOCATE 'NEW' MEMORY SPACE ; Allocate proper size of memory at the proper place. $aCall = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", _ "ptr", $hProcess, _ "ptr", $pOptionalHeaderImageBaseNEW, _ "dword", $iOptionalHeaderSizeOfImageNEW, _ "dword", 12288, _ ; MEM_COMMIT|MEM_RESERVE "dword", 64) ; PAGE_EXECUTE_READWRITE If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(10, 0, 0) ; VirtualAllocEx function or call to it failed EndIf Local $pRemoteCode = $aCall[0] ; from now on this is zero-point #Region 8. GET AND WRITE NEW PE-HEADERS Local $pHEADERS_NEW = DllStructGetPtr($tIMAGE_DOS_HEADER) ; starting address of binary image headers Local $iOptionalHeaderSizeOfHeadersNEW = DllStructGetData($tIMAGE_OPTIONAL_HEADER, "SizeOfHeaders") ; the size of the MS-DOS stub, the PE header, and the section headers ; Write NEW headers $aCall = DllCall("kernel32.dll", "int", "WriteProcessMemory", _ "ptr", $hProcess, _ "ptr", $pRemoteCode, _ "ptr", $pHEADERS_NEW, _ "dword", $iOptionalHeaderSizeOfHeadersNEW, _ "dword*", 0) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(11, 0, 0) ; WriteProcessMemory function or call to it while writting new PE headers failed EndIf #Region 9. WRITE SECTIONS ; Dealing with sections. Will write them too as they hold all needed data that PE loader reads Local $tIMAGE_SECTION_HEADER Local $iSizeOfRawData, $pPointerToRawData Local $iVirtualAddress For $i = 1 To $iNumberOfSections $tIMAGE_SECTION_HEADER = DllStructCreate("char Name[8];" & _ "dword UnionOfVirtualSizeAndPhysicalAddress;" & _ "dword VirtualAddress;" & _ "dword SizeOfRawData;" & _ "dword PointerToRawData;" & _ "dword PointerToRelocations;" & _ "dword PointerToLinenumbers;" & _ "ushort NumberOfRelocations;" & _ "ushort NumberOfLinenumbers;" & _ "dword Characteristics", _ $pPointer) $iSizeOfRawData = DllStructGetData($tIMAGE_SECTION_HEADER, "SizeOfRawData") $pPointerToRawData = DllStructGetPtr($tIMAGE_DOS_HEADER) + DllStructGetData($tIMAGE_SECTION_HEADER, "PointerToRawData") $iVirtualAddress = DllStructGetData($tIMAGE_SECTION_HEADER, "VirtualAddress") ; If there is data to write, write it where is should be written If $iSizeOfRawData Then $aCall = DllCall("kernel32.dll", "int", "WriteProcessMemory", _ "ptr", $hProcess, _ "ptr", $pRemoteCode + $iVirtualAddress, _ "ptr", $pPointerToRawData, _ "dword", $iSizeOfRawData, _ "dword*", 0) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(12, $i, 0) ; WriteProcessMemory function or call to it while writting new sections failed EndIf EndIf ; Move pointer $pPointer += 40 ; size of $tIMAGE_SECTION_HEADER structure Next #Region 10. NEW ENTRY POINT ; Entry point manipulation DllStructSetData($tCONTEXT, "Eax", $pRemoteCode + $iEntryPointNEW) ; $iEntryPointNEW was relative address #Region 11. SET NEW CONTEXT ; New context: $aCall = DllCall("kernel32.dll", "int", "SetThreadContext", _ "ptr", $hThread, _ "ptr", DllStructGetPtr($tCONTEXT)) If @error Or Not $aCall[0] Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(13, 0, 0) ; SetThreadContext function or call to it failed EndIf #Region 12. RESUME THREAD ; And that's it!. Continue execution $aCall = DllCall("kernel32.dll", "int", "ResumeThread", "ptr", $hThread) If @error Or $aCall[0] = -1 Then DllCall("kernel32.dll", "int", "TerminateProcess", "ptr", $hProcess, "dword", 0) Return SetError(14, 0, 0) ; ResumeThread function or call to it failed EndIf #Region 13. RETURN SUCCESS ; All went well. Return, for example, new PID: Return DllStructGetData($tPROCESS_INFORMATION, "ProcessId") EndFunc1 point -
Do a switch on the control id first? #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #include <WinAPI.au3> $hMain = GUICreate("Test", 400, 400) $cButton = GUICtrlCreateButton("Click Me", 100, 100, 100, 30) $cInput = GUICtrlCreateInput("", 100, 200, 100, 30) GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') GUISetState(@SW_SHOW, $hMain) While True Switch GUIGetMsg() Case $cButton MsgBox(0, "Message", "You just clicked me.") Case -3 ; GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Switch _WinAPI_LoWord($wParam) ; iIDFrom Case $cInput Switch _WinAPI_HiWord($wParam) ; iCode Case $EN_CHANGE TrayTip("Read", GUICtrlRead(_WinAPI_LoWord($wParam)), 1) ;Return 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMANDEdit: Also you used $hButton = GUICtrlCreateButton("Click Me", 100, 100, 100, 30) from the "h" I would think the variable contains a handle. I recommend to use something more like this: $cButton = GUICtrlCreateButton("Click Me", 100, 100, 100, 30) $hButton = GUICtrlGetHandle($cButton)1 point
-
Thanks to different UDF's around the forums I was able to create one to read those crazy .DocX files that Microsoft Word now uses >_< I've gone through and opened as many 'docX' files as I had on my computer. All of them work now with this. Below is the example AND the functions. I havn't taken the time to UDF format it. I would like people to make sure it works before I spend the time making this into one function. So give it a try and tell me how it works ClipPut(_ReadDocXContent(@ScriptDir & '\DocXtest.docx')) Func _ReadDocXContent($ReadLocation) $Name = @ScriptDir & "\TempDoc.zip" $UnZipName = @ScriptDir & '\DocXdoc' FileCopy($ReadLocation, $Name, 1) _Zip_Unzip($Name, "word\document.xml", $UnZipName, 16) If @error Then Return 0 Sleep(200) $Text = FileRead(@ScriptDir & '\DocXdoc\document.xml') $RegEx = StringRegExp($Text, "<w:body>(.*?)<w:sect", 3) $RegEx = StringRegExpReplace($Regex[0], "<w:br/>", @CRLF, 0) $RegEx = StringRegExpReplace($Regex, "</w:p>", @CRLF & @CRLF, 0) $RegEx = StringRegExpReplace($Regex, "<w:tab/>", @TAB, 0) $RegEx = StringRegExpReplace($Regex, "<(.*?)>", "", 0) $RegEx = StringRegExpReplace($Regex, "<", "<", 0) $RegEx = StringRegExpReplace($Regex, ">", ">", 0) $RegEx = StringRegExpReplace($Regex, "&", "&", 0) $RegEx = StringRegExpReplace($Regex, "รข", '"', 0) $RegEx = StringRegExpReplace($Regex, "รข", '"', 0) $RegEx = StringRegExpReplace($Regex, "รข", "'", 0) $RegEx = StringRegExpReplace($Regex, "รข", "'", 0) $RegEx = StringRegExpReplace($Regex, "รข", "-", 0) $RegEx = StringRegExpReplace($Regex, "รขยฆ", "...", 0) FileDelete($Name) DirRemove($UnZipName, 1) $RegEx = StringTrimRight($RegEx, 4) Return $RegEx EndFunc Func _Zip_Unzip($hZipFile, $hFilename, $hDestPath, $flag = 4) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If Not FileExists($hDestPath) Then DirCreate($hDestPath) $oApp = ObjCreate("Shell.Application") $hFolderitem = $oApp.NameSpace($hZipFile).Parsename($hFilename) $oApp.NameSpace($hDestPath).Copyhere($hFolderitem, $flag) EndFunc ;==>_Zip_Unzip Func _Zip_DllChk() If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2 If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3 Return 0 EndFunc ;==>_Zip_DllChk If there are any other 'characters' I missed please let me know. I went through the keyboard and tried as many as I could. So hopefully nothing is missing there. Hope this helps! Szhlopp1 point
-
metis, It sounds as if a "cuebanner" is what you need: #include <GUIConstantsEX.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("", 500, 300) GUICtrlCreateLabel("Info", 10, 5) Local $aInput[6][2] = [[0, "Name"],[0, "Address"],[0, "Home Phone"],[0, "Mobile Phone"],[0, "Date of birth"],[0, "Town"]] For $i = 0 To UBound($aInput) - 1 $aInput[$i][0] = GUICtrlCreateInput("", 10, (20 * ($i + 1)), 140, 20) GUICtrlSendMsg(-1, $EM_SETCUEBANNER, True, $aInput[$i][1]) Next GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd ;Does not work for edit controls with $ES_MULTILINE style. ;In XP, the banner disappears when the edit has focus (cursor in edit) ;In Vista/7 the banner can optionally still appear when the edit has focus (cursor in edit) ;(third parameter = True/False)Was I right? M231 point
-
- That's affirmative. But isn't it too obvious? After reading the first post in the thread, this question should not arise.1 point
-
it worked. thanks. this is what I used: ShellExecuteWait("net", "user USERNAME NEWPASSWORD")1 point
-
I see. I'm not sure how to get that for external programs.. If you initiate the download with InetGet in your own script though, this should work: $TotalSize = InetGetSize ( "ftp://ftp.microsoft.com/Products/frontpage/fp40.rs6000.tar.Z") INetGet("ftp://ftp.microsoft.com/Products/frontpage/fp40.rs6000.tar.Z","File",1,1) $hWnd = GUICreate("") $Label = GUICtrlCreateLabel("",5,5,200,40) GUISetState() $Time = @SEC While 1 $msg = GUIGetMsg() $Time = @SEC $Bytes = Round(@InetGetBytesRead) While @SEC = $Time WEnd $NewBytes = Round(@InetGetBytesRead) GUICtrlSetData($Label,($NewBytes - $Bytes) /1024 & "KB/s") WEnd1 point
-
If you mean the name of the drive shown in "My Computer", try my script based on the info at http://hacks.oreilly.com/pub/h/1105 The following code requires the beta version of AutoIt that has Object/COM support: $driveLetter = "X:" DriveMapAdd($driveLetter, "\\SERVER\SHARE") $oShell = ObjCreate("shell.application") $oShell.NameSpace($driveLetter).Self.Name = "New name goes here"1 point