
Monamo
Active Members-
Posts
470 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Monamo
-
Simple Script with HotKeySet doesn't work
Monamo replied to foxnbk's topic in AutoIt General Help and Support
Based on your wording, I assume this is the full content of your script. If that's the case, then basically what you need to do is to include some form of loop to keep the script active while it's waiting for input (in the form of your hotkey). Give this a shot (press ESC to exit the script): HotKeySet("{F4}", "StartProg") HotKeySet("{ESC}","_ExitIt") While 1 Sleep(10) Wend Func _ExitIt() Exit() EndFunc Func StartProg() Sleep (100) MouseClick ("left", 569, 728) Sleep (100) MouseClick ("left", 607, 732) Sleep (100) MouseClick ("left", 469, 658) Sleep (100) EndFunc -
Looks like it's just going for one pass too many in your For... loop. Try changing that line to: For $i1=1 To (UBound($get_dirs)-1)
-
Just added $ before new_docent. that's where I think the error is since you say that the value for $new_docent30 = GUICtrlRead($docent30) Not in this case. You wouldn't insert the $ manually as Eval() will, well, evaluate the data and interpret it as a variable after processing the string data.i.e., Eval("firststring" & "secondstring") would be interpreted as $firststringsecondstring
-
Change your style entry to: BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL)
-
The issue was because the script was written based upon AutoIt v3.2.10.0 (as noted in the original post). There were code changes made in subsequent releases that caused other #include entries to be required. The code in the original post has been updated to support AutoIt v3.3.0.0. Enjoy!
-
When you put the opening and closing tags for your function, do you actually call the function in your code separately? That is... test() Func test() ; code block EndFunc
-
Current Build: v1.2 (27 FEB 2009) I've had to go through hoops too many times trying to track down the originating process when a random notification/dialog pops up on my system. I wrote the following as a quick way to trace them. Running the script provides you with a small GUI that contains a combobox of visible windows. Selecting a window from the list will provide a messagebox with process information (process executable, file location, PID) and will open the containing folder in Windows Explorer. If it's of use to you, have at it. Otherwise, thanks for taking a look. Comments welcome. Version History: v1.0 (26 FEB 2009) :Note:Codebase is for AutoIt 3.2.10.0 (still at this build by work mandate), so those running the later builds will have to account for the replacement of the GUIConstants.au3 reference with GUIConstantsEx.au3 and possible others. v1.2 (27 FEB 2009) : Codebase updated to function with AutoIt v3.3.0.0 (Yay for VMWare) Window_Tracer_v1_2.au3 Edit: code update
-
Does the folder "World of Warcraft" already exist on your desktop? Based upon your sample default data, it would try to drop the file into a resulting path of: C:\Users\Ashley\Desktop\World of Warcraft\BackgroundDownloader.exe I don't see any checks for an appropriate folder structure before attempting to drop the file - if that destination folder doesn't exist, you're gonna come up short.
-
There have been changes made to the language since this was first posted (note that the post is from 2005). I didn't dig too deeply, but here's the code with a couple quick modifications to allow it to function with AutoIt v3.3.0.0 (not thoroughly tested, but I leave the rest to you for implementation for your usage): CODE#cs Admin_Popup Show computer information or launch shell when hotkey is pressed -John Taylor May-24-2005 - code modifications added to allow functionality with AutoIt v3.3.0.0 on 05 FEB 2009 #ce #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> #NoTrayIcon Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) ;Opt ("RunErrorsFatal", 0 ) - parameter no longer valid as of release 3.2.12.0 Dim $Info_Title = "System Info" Dim $Shell_Title = "Run Shell" Dim $UsernameID Dim $PasswordID Dim $Shell_Win Dim $_In_Shell = 0 HotKeySet("^!~", "OnInfo") ; control alt ~ HotKeySet("+^!{TAB}", "OnShell") ; shift control alt tab While 1 Sleep(1000) WEnd Func OnShell() Dim $SubmitID $_In_Shell = 1 $Shell_Win = GUICreate($Shell_Title, 270, 150) GUISetState() GUICtrlCreateLabel("Username:", 10, 30) $UsernameID = GUICtrlCreateInput("Administrator", 65, 30, 120) GUICtrlCreateLabel("Password:", 10, 60) $PasswordID = GUICtrlCreateInput("", 65, 60, 120, -1, $ES_PASSWORD) $SubmitID = GUICtrlCreateButton("Submit", 10, 90,50,20,$BS_DEFPUSHBUTTON ) GUICtrlSetOnEvent($SubmitID, "onsubmit") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") ControlFocus($Shell_Title, "", $PasswordID) While 1 = $_In_Shell Sleep(1000) WEnd EndFunc ;==>OnShell Func onsubmit() Dim $u, $p $u = GUICtrlRead($UsernameID) $p = GUICtrlRead($PasswordID) RunAs($u,"",$p,1,@ComSpec,"C:\") If @error Then MsgBox(16,"Error","Unable to launch Command Prompt. Please verify the credentials used.") EndIf ;RunAsSet($u, "", $p, 1) ;Run(@ComSpec, "C:\") OnExit() EndFunc ;==>onsubmit Func OnExit() $_In_Shell = 0 ;MsgBox(0,"Debug","starting OnExit()") GUIDelete($Shell_Win) EndFunc ;==>OnExit Func OnInfo() Dim $data[15] Dim $i = 0 Dim $output = "" $data[1] = "Computer name: " & @ComputerName $data[2] = "User name:" & @UserName $data[3] = "---------------------------------------" $data[4] = "1st IP: " & @IPAddress1 $data[5] = "2nd IP: " & @IPAddress2 $data[6] = "---------------------------------------" $data[7] = "OS: " & @OSVersion & " " & @OSServicePack For $i = 1 To 7 $output = $output & $data[$i] & @CR Next MsgBox(0, $Info_Title, $output, 7) EndFunc ;==>OnInfo ; end of script
-
What email client are you using?
-
For those that typically have "Hide file extensions for known file types" disabled in Windows XP, it's an annoyance (at least for me) that using the Windows hotkey "F2" to rename files manually causes you to have to take care to avoid clearing the file extension. Lifehacker had an AHK script (they're big on AHK) to address this, and I've converted it to AutoIt for those that might want to use it. My recommendation would be to include it inside of any "persistent" scripts that you have running all the time (say, inside of a system monitoring script, whatever) since it seems kind of excessive to have a compiled version of this running standalone. Unless, of course, you don't have any other "always on" scripts. Hope it's of use to some of you out there. HotKeySet("{F2}", "_AnalyzeRename") While 1 Sleep(10) WEnd Func _AnalyzeRename() HotKeySet("{F2}"); prevent infinite loop gotcha Send("{F2}") If (_WinGetClass(WinGetTitle('')) = "CabinetWClass") Or (_WinGetClass(WinGetTitle('')) = "Progman") Then $oldClipboard = ClipGet() Sleep(100) Send("^c") $sFilename = ClipGet() $iExtPosition = StringInStr($sFilename, ".", 0, -1) If $iExtPosition <> 0 Then $iPosition = StringLen($sFilename) - $iExtPosition $i = 0 Send("^{HOME}") Do Send("+{RIGHT}") $i += 1 Until $i = ($iExtPosition - 1) Send("{SHIFTDOWN}{SHIFTUP}") EndIf ClipPut($oldClipboard) EndIf HotKeySet("{F2}", "_AnalyzeRename"); re-enable hotkey EndFunc Func _WinGetClass($hWnd) ; credit = SmOke_N from post http://www.autoitscript.com/forum/index.php?showtopic=41622&view=findpost&p=309799 If IsHWnd($hWnd) = 0 And WinExists($hWnd) Then $hWnd = WinGetHandle($hWnd) Local $aGCNDLL = DllCall('User32.dll', 'int', 'GetClassName', 'hwnd', $hWnd, 'str', '', 'int', 4095) If @error = 0 Then Return $aGCNDLL[2] Return SetError(1, 0, '') EndFunc
-
GUICtrlSetColor($progressBar,0xFF0000)
-
Short answer -> check here. Methodology: You'll need to change the "Wallpaper" value in the registry under HKEY_CURRENT_USER\Control Panel\Desktop to update the path to the new image ("WallpaperStyle" changes stretch/center/tile option), then run: RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters Happy scripting.
-
Look into: _IsPressed()Send() or ControlSend()in the help file
-
What you're encountering is the keyboard "Repeat Delay" setting (Control Panel -> Keyboard Settings). There is a default delay when pressing a keyboard key before it automatically repeats the keypress activity. As for DLL/UDF access to a modification of this property, I'm unsure - but hopefully this information will help narrow down your search criteria.
-
The only (quick) workaround I've found is to manually create an appropriate registry key for the "custom" event log before attempting the write process. Basically, if Windows doesn't find a matching custom title, it will default to the "Application" entries. Create a reg key under: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\MyCustomEventsand see if that works for you.
-
Take out the colon, it's a character that can't be used in file names.
-
Something like this?
-
Test will not go away after control is deleted
Monamo replied to jtsteffen's topic in AutoIt GUI Help and Support
The problem is that when you click Button 1 the first time, you're creating a label control with a specific "control id" - But your second click (while the first control exists still) is creating a new label control exactly on top of the existing one and assigning that id to $NoLocalReturn, essentially leaving the first one in limbo. When you click Button 2, it's "working" - it's deleting the new control id referenced by the $NoLocalReturn variable. What you're left with is the first one created. Example: Click Button1 - $NoLocalReturn label created with control id = "5"Click Button1 - (new) $NoLocalReturn label created with control id = "6" <== This is where you lose a variable pointer to control id "5"Button 2 - Deletes Control id "6"What you could do is simply create the label when you create the rest of your GUI elements, and just hide/show the label as needed. Either that or create it with no text and just toggle using GUICtrlSetData() to set the "no files" message or an empty string "". There are a handful of ways to handle it, but hopefully the explanation above will help you understand the "why" of the issue. -
Try the $CBS_DROPDOWNLIST style on the combo box
-
GUICtrlSetOnEvent on dynamic menu items
Monamo replied to ACalcutt's topic in AutoIt General Help and Support
You could use the GUICtrlRead() function with the advanced parameter (without the advanced parameter, you'll just get the state of the menu item). An example function to show the return based upon your posted code would be (AutoIt v3.2.10.0): Func _InterfaceChanged() ConsoleWrite(GUICtrlRead(@GUI_CtrlId,1) &" was selected." &@CRLF) EndFunc -
The registry is basically the route I had to resort to as well. I was originally hoping to get the data from a WMI query, but the Win32_FontInfoAction, though it contains a "Font Title" parameter, never gave any data results (the only fields with data returned were "ActionID" and "File" for each). Here's a method to snag the list from the registry (AutoIt v3.2.10.0): #include <Array.au3> Dim $aFonts[1] = ["0"] $sRegRoot = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" $i = 1 Do $var = RegEnumVal($sRegRoot, $i) If Not @error Then $iIndex = $aFonts[0] +1 ReDim $aFonts[$iIndex + 1] $aFonts[0] = $iIndex $aFonts[$iIndex] = $var EndIf $i += 1 Until @error _ArraySort($aFonts,0,1) _ArrayDisplay($aFonts)
-
Use the AutoIt Window Info tool to get the button's information (instance, etc) and then use the ControlCommand() function to get the state. The "Command" list for that function has an "IsEnabled" value that should (hopefully) get the state information you're looking for.
-
Example using Calculator: #include <Constants.au3> $hWnd = "" $iPID = ProcessExists("calc.exe") If $iPID <> 0 Then $aWinList = WinList() For $i = 1 To $aWinList[0][0] If WinGetProcess($aWinList[$i][0]) = $iPID Then $hWnd = $aWinList[$i][1] ExitLoop EndIf Next EndIf If $hWnd <> "" Then MsgBox(0, 0, WinGetTitle($hWnd) & @CRLF & $hWnd) Else MsgBox(64, "Not Found", "No matching process found.") EndIf