Leaderboard
Popular Content
Showing content with the highest reputation on 12/27/2017 in all areas
-
So why do you think it should run? an AU3 file in not an executable so it needs another executable file, autoit3.exe, to be executed. When using CMD.exe and the default for .au3 is set to open with autoit3.exe, it might run properly. so either use ShellExecuteWait() or change the array to: $aApps[0] = @comspec & " /c C:\Users\villarrealv\desktop\1\wylie-ccw.au3" -or for using RunWait() to: $aApps[0] = '"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "C:\Users\villarrealv\desktop\1\wylie-ccw.au3"' Jos2 points
-
[SOLVED] to DLLopen or not ( as in "to be or not to be")
Earthshine and one other reacted to RTFC for a topic
1) The dll itself may already be in virtual memory due to earlier calls (and you'd probably need heavy-duty benchmarking to perceive a notable difference anyhow) 2) avoid memory leaks due to dangling handles2 points -
LNKEditorGUI - Windows Shortcut LNK Link Editor GUI
Earthshine reacted to robertcollier4 for a topic
Scenario: Editing .lnk shortcuts with the Windows dialog is very frustrating due to the small input boxes and non-resizable small dialog window. Very often you need to create a link with a long path and many arguments which becomes hard to see and make edits. Solution: LNKEditorGUI is a resizable and easy to use creator and editor of LNK Windows Shortcut files. This GUI uses built-in AutoIt functions FileGetShortcut() and FileCreateShortcut() to read and write .lnk files. A nice and big (and resizable) GUI is presented with which the user can easily edit and create LNK shortcuts with. A command line argument is accepted and the GUI will automatically open the first file passed to it as an argument allowing for easy association on the right-click menu (see .lnk file right-click context menu registry association example below). Download: LNKEditorGUI.zip Screenshot: Reg Script Use a Registry Script such as following to create a right-click menu entry for LnkEditorGUI for .lnk files. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\lnkfile\shell\LNKEditorGUI] @="LNK&EditorGUI" [HKEY_CLASSES_ROOT\lnkfile\shell\LNKEditorGUI\command] @="\"C:\\Program Files\\LNKEditorGUI.exe\" \"%1\"" LNKEditorGUI.au3 Code: #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <GuiStatusBar.au3> #include <Timers.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) Global Const $CmbWinstateNorm = @SW_SHOWNORMAL & " - Normal Window" Global Const $CmbWinstateMin = @SW_SHOWMINNOACTIVE & " - Minimized" Global Const $CmbWinstateMax = @SW_SHOWMAXIMIZED & " - Maximized" #region - GUI $GUI = GUICreate("LNKEditorGUI - Windows Shortcut LNK File Editor", 800, 640, -1, -1, BitOr($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX ), $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, '_exit') GUISetOnEvent($GUI_EVENT_DROPPED, "On_Drop_InFilename") GUISetFont(10) $Status = _GUICtrlStatusBar_Create($GUI) GUICtrlCreateLabel("File:", 4, 6, 36, 24) $inFilename = GUICtrlCreateInput("", 36, 4, 672, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $btBrowseForFile = GUICtrlCreateButton("Browse...", 712, 4, 84, 24) GUICtrlSetOnEvent(-1, '_btBrowseForFile') $btOpenFile = GUICtrlCreateButton("Load LNK File", 20, 32, 370, 28) GUICtrlSetOnEvent(-1, '_btOpenFile') GUICtrlSetResizing($btOpenFile, $GUI_DOCKLEFT) $btSaveFile = GUICtrlCreateButton("Save LNK File", 410, 34, 370, 28) GUICtrlSetOnEvent(-1, '_btSaveFile') GUICtrlSetResizing($btSaveFile, $GUI_DOCKRIGHT) GUICtrlCreateLabel("Target EXE", 4, 80, 172, 24) $inTargetEXE = GUICtrlCreateInput("", 4, 104, 792, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Target Arguments", 4, 148, 172, 24) $editTargetArgs = GUICtrlCreateEdit("", 4, 172, 792, 96, $ES_MULTILINE) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Working Dir", 4, 288, 172, 24) $inWorkingDir = GUICtrlCreateInput("", 4, 312, 792, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Window State", 4, 356, 172, 24) $cmbWindowState = GUICtrlCreateCombo("", 4, 380, 792, 24, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, $CmbWinstateNorm & "|" & $CmbWinstateMin & "|" & $CmbWinstateMax, $CmbWinstateNorm) ; add other item snd set a new default GUICtrlCreateLabel("Icon File", 4, 424, 172, 24) $inIconFile = GUICtrlCreateInput("", 4, 448, 650, 24) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlCreateLabel("Icon Index", 680, 424, 172, 24) $inIconIndex = GUICtrlCreateInput("", 674, 448, 112, 24) GUICtrlCreateLabel("Comment", 4, 492, 172, 24) $editComment = GUICtrlCreateEdit("", 4, 516, 792, 96, $ES_MULTILINE) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW, $GUI) #endregion - GUI If $CmdLine[0] > 0 Then ;MsgBox(0,0,$CmdLine[1]) GUICtrlSetData($inFilename, $CmdLine[1]) _btOpenFile() EndIf While 1 Sleep(100) WEnd ;--------------------------------------------------------------- Func StatusBarNotify($msg) _GUICtrlStatusBar_SetText($Status, $msg) _Timer_SetTimer($GUI, 5000, "_ClearStatusBar") EndFunc ;--------------------------------------------------------------- Func _ClearStatusBar($hWnd, $msg, $iIDTimer, $dwTime) #forceref $hWnd, $msg, $iIDTimer, $dwTime _GUICtrlStatusBar_SetText($Status, "") _Timer_KillTimer($hWnd, $iIDTimer) EndFunc ;--------------------------------------------------------------- Func _btBrowseForFile() Local $var = FileSaveDialog("Choose a LNK File Name", "D:\", "LNK Shortcuts (*.lnk)", 2) ; option 2 = dialog remains until valid path/file selected If @error Then ;MsgBox(4096, "", "No File(s) chosen") Else $var = StringReplace($var, "|", @CRLF) GUICtrlSetData($inFilename, $var) EndIf EndFunc ;--------------------------------------------------------------- Func On_Drop_InFilename() If ( (@GUI_DropId = $inFilename) OR (@GUI_DropId = $inTargetEXE) ) Then GUICtrlSetData(@GUI_DropId, @GUI_DragFile) EndIf If ( (@GUI_DropId = $inFilename) AND (@GUI_DragFile <> "") ) Then OpenFile(@GUI_DragFile) EndIf EndFunc ;--------------------------------------------------------------- Func _btOpenFile() Local $filename = GUICtrlRead($inFilename) If $filename = "" Then ;_btBrowseForFile() ;$filename = GUICtrlRead($inFilename) StatusBarNotify("ERROR: Trying to open file but no file specified.") MsgBox(0,"ERROR","Trying to open file but no file specified.") Else OpenFile($filename) EndIf EndFunc ;--------------------------------------------------------------- Func OpenFile($filename) Local $lnkArray = FileGetShortcut($filename) If Not @error Then ;_ArrayDisplay($lnkArray) Else StatusBarNotify("ERROR: Unable to open file.") MsgBox(0,"ERROR","Unable to open file, please check the file name.") Return EndIf GUICtrlSetData($inTargetEXE, $lnkArray[0]) GUICtrlSetData($editTargetArgs, $lnkArray[2]) GUICtrlSetData($inWorkingDir, $lnkArray[1]) GUICtrlSetData($inIconFile, $lnkArray[4]) GUICtrlSetData($inIconIndex, $lnkArray[5]) GUICtrlSetData($editComment, $lnkArray[3]) If($lnkArray[6] = @SW_SHOWNORMAL) Then GUICtrlSetData($cmbWindowState, $CmbWinstateNorm) ElseIf($lnkArray[6] = @SW_SHOWMINNOACTIVE) Then GUICtrlSetData($cmbWindowState, $CmbWinstateMin) ElseIf($lnkArray[6] = @SW_SHOWMAXIMIZED) Then GUICtrlSetData($cmbWindowState, $CmbWinstateMax) EndIf StatusBarNotify("Successfully loaded file: " & $filename) EndFunc ;--------------------------------------------------------------- Func _btSaveFile() $filename = GUICtrlRead($inFilename) If $filename = "" Then StatusBarNotify("ERROR: Trying to save but no file name specified.") MsgBox(0,"ERROR","Trying to save but no file name specified.") Return EndIf Local $WinStateToWrite Switch GuiCtrlRead($cmbWindowState) Case $CmbWinstateNorm $WinStateToWrite = @SW_SHOWNORMAL Case $CmbWinstateMin $WinStateToWrite = @SW_SHOWMINNOACTIVE Case $CmbWinstateMax $WinStateToWrite = @SW_SHOWMAXIMIZED Case Else $WinStateToWrite = @SW_SHOWNORMAL EndSwitch $saveResult = FileCreateShortcut(GuiCtrlRead($inTargetEXE), $filename, GuiCtrlRead($inWorkingDir), GuiCtrlRead($editTargetArgs), GuiCtrlRead($editComment), GuiCtrlRead($inIconFile), "", GuiCtrlRead($inIconIndex), $WinStateToWrite) If($saveResult) Then StatusBarNotify("Successfully saved file to: " & $filename) Else StatusBarNotify("ERROR: Unable to save file, please check the file name and values.") MsgBox(0,"ERROR","Unable to save file, please check the file name and values.") EndIf EndFunc ;--------------------------------------------------------------- Func _exit() Exit EndFunc ;---------------------------------------------------------------1 point -
[SOLVED] to DLLopen or not ( as in "to be or not to be")
argumentum reacted to RTFC for a topic
If called with the filename, the dll is closed immediately after the call; if called with the earlier obtained handle it stays open until closed by the user or AFAIK upon normal script termination (although this is sloppy practice ,and you shouldn't rely on it). However, in case of abnormal termination/crash, you may have a memory leak. I would suggest you call the GDI Startup function (because there are version-specific settings involved) rather than opening that dll directly. But in general, any dll can be opened and closed on a call-by-call basis using the filename or user-opened and closed separately. Regarding filename-based calls in the standard includes such as <Date.au3>, remember that these UDFs are meant to function on their own, without users needing to be aware of handles to be obtained first or closed after. So by sacrificing a little processing speed, calling a dll function can be made a single action, which makes the task much easier for beginners, and more empowering. Well, I guess you'll have to be thankful he didn't have mountaineering boots with ice crampons close to hand.1 point -
[SOLVED] to DLLopen or not ( as in "to be or not to be")
Earthshine reacted to Jos for a topic
Thought that question was answered already by @RTFC. When you use DllCall() with a filename, AutoIt3 will perform DllOpen();DllCall();DllCLose() for you. This is fine when doing a single DllCall, but when you want to do a thousand DllCall as fast as possible you can imagine it is faster to one DllOpen() at the beginning, then do all the DllCall's using the openen filehandle and then close it..... right? Same counts for FileRead/FileWrite operations. Jos1 point -
Checkbox needed to run other auto it scripts
Earthshine reacted to Jos for a topic
Please do me/us a favor (and yourself) and explain what you really want to run so we understand what you are trying to do. So show some exact code that can we played with. Jos1 point -
Automate EXE installation with wait option
Earthshine reacted to Jos for a topic
chill-pill time it is master Eathshine1 point -
SID Binary to SID String
Earthshine reacted to spudw2k for a topic
Recently I was using csvde to execute some LDAP queries on a domain controller to create some reports. I noticed that when I queried the objectSID, it was returned (output) in binary format instead of the S-#-#-##-### (string) format I needed to compare with. I found there was a function I could use in the Security.au3 UDF to convert the SID Binary value to the SID String format; however, the example in the help file collected the SID binary value by using another function to lookup an AD object by name. Since I already had the SID, this "step" was erroneous to me, but I was still required to do some work to make the _Security__SidToStringSid function accept my binary values--namely creating and populating a DLLStruct before using as a parameter for the SidToSTringSid function. Below is a small illustration of what I did. It wasn't particularly complicated or difficult, but may provide some insight to folks who don't mess/work with DLLStructs much. Also, my "real" script utilized a lengthy CSV report and parsed it to replace the binary values with the SID strings. I just wanted to share this snippet. #include <security.au3> msgbox(0,"Builtin\Users",_SIDBinaryToStr("01020000000000052000000021020000")) msgbox(0,"Builtin\Guests",_SIDBinaryToStr("01020000000000052000000022020000")) msgbox(0,"Domain Users",_SIDBinaryToStr("010500000000000515000000e2ef6c5193efdefff2b6dd4401020000")) Func _SIDBinaryToStr($hSID) Local $tSID = DllStructCreate("byte SID[256]") DllStructSetData($tSID, "SID", Binary("0x" & $hSID)) Local $sStringSID = _Security__SidToStringSid($tSID) Return $sStringSID EndFunc1 point -
Hello, have a look at the outlook UDF. Or, in case you want to connect to a POP3 box, you could directly poll the content of the POP3 mailbox. e.g. this might be a start, at least to give you some ideas what to google for: https://kewl.lu/articles/pop3/ Regards, Rudi.1 point
-
Need some basic help
Earthshine reacted to Jos for a topic
Which part in that code needs explanation after you tried reading/interpreting and checking the helpfile? Jos1 point -
Need some basic help
argumentum reacted to jskov9850 for a topic
Alright guys, I made it work. Though, I'm kind of interested in this. Can someone explain what it does? ;Something like this? For $i = 1 To 3 Send("{ENTER}" & $i & "{TAB}{TAB}") Next1 point -
FS Capture to start recording?
Earthshine reacted to careca for a topic
You didn't ask me anything, that's true, you asked for help in general, i was the only one who answered, pointed you in the right direction, and now you come at me like that? That attitude doesn't help. Cya.1 point -
FS Capture to start recording?
Earthshine reacted to Jos for a topic
Merry Christmas to you too. Jos1 point