
user52
Active Members-
Posts
61 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by user52
-
#include <String.au3> $str = _ 'this.' & _ 'is.a.' & _ 'strin' & _ 'g' ConsoleWrite(chunk_split($str, 5) & @CRLF) ConsoleWrite('============================================================================' & @CRLF) $str = _ 'this.is.the.start.of' & _ '.some.string.that.sh' & _ 'ould.be.split.into.c' & _ 'hunks' & _ '' ConsoleWrite(chunk_split($str, 20) & @CRLF) Func chunk_split($body, $chunklen = 76, $end = @CRLF) $len = StringLen($body) $chunks = Ceiling($len / $chunklen) $end_len = StringLen($end) $newbody = $body $ends = 0 For $i = $chunklen To $len Step $chunklen $pos = ($chunklen * $ends) + ($end_len * $ends) + $chunklen $newbody = _StringInsert($newbody, $end, $pos) $ends += 1 Next Return $newbody EndFunc ;==>chunk_split #cs this. is.a. strin g ============================================================================ this.is.the.start.of .some.string.that.sh ould.be.split.into.c hunks #ce
-
# \Program Files\AutoIt3\SciTE\SciTEConfig\scite-config.SciTEConfig #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-# # Dark SciTE4AutoIt3 Color scheme #------------------------------------------------------------ font.base=font:Arial,size:10,$(font.override) font.monospace=font:Courier New,size:10 proper.case=0 check.updates.scite4autoit3=1 use.tabs=1 indent.size=4 indent.size.*.au3=4 tabsize=4 #Background style.au3.32=style.*.32=$(font.base),back:#F0F4F9 #CaretLineBackground caret.line.back=#FFFED8 # Brace highlight style.au3.34=fore:#0000FF,bold,back:#F0F4F9 # Brace incomplete highlight style.au3.35=fore:#009933,italics,back:#F0F4F9 #White space style.au3.0=fore:#000000,back:#F0F4F9 #Comment line style.au3.1=fore:#009933,italics,back:#F0F4F9 #Comment block style.au3.2=fore:#669900,italics,back:#F0F4F9 #Number style.au3.3=fore:#AC00A9,italics,bold,back:#F0F4F9 #Function style.au3.4=fore:#000090,italics,bold,back:#F0F4F9 #Keyword style.au3.5=fore:#0000FF,bold,back:#F0F4F9 #Macro style.au3.6=fore:#FF33FF,bold,back:#F0F4F9 #String style.au3.7=fore:#9999CC,bold,back:#F0F4F9 #Operator style.au3.8=fore:#FF0000,bold,back:#F0F4F9 #Variable style.au3.9=fore:#AA0000,bold,back:#F0F4F9 #Sent keys style.au3.10=fore:#FF8800,bold,back:#F0F4F9 #Pre-Processor style.au3.11=fore:#F000FF,italics,back:#F0F4F9 #Special style.au3.12=fore:#A00FF0,italics,back:#F0F4F9 #Abbrev-Expand style.au3.13=fore:#FF0000,bold,back:#F0F4F9 #Com Objects style.au3.14=fore:#0000FF,italics,bold,back:#F0F4F9 #Standard UDF's style.au3.15=fore:#0080FF,italics,bold,back:#F0F4F9 # END => DO NOT CHANGE ANYTHING BEFORE THIS LINE #-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-
Jos, I do agree and I can see not replacing SciTE.exe, SciLexer.dll for AutoIt users. My intention was to have a setup where one could simply extract the zip and run SciTE without installing AutoIt and the SciTE4AutoIt3. As for the properties files, there are colors defined in there, see for example perl.properties It sounds like I'm going to need to separate this for AutoIt users. Which files should I not replace for AutoIt users? Thanks
-
Thanks Damian. I've added Install (http://code.google.com/p/scite-config/#Install): 1. Download http://code.google.com/p/scite-config/downloads/list 2. Extract to C:\Program Files\AutoIt3\SciTE\ 3. Run C:\Program Files\AutoIt3\SciTE\SciTE.exe Download http://code.google.com/p/scite-config/downloads/list Edit: download link
-
UPDATE: The original instructions didn't include the exact colors from the screen shots. 1. Download scite-config from http://code.google.com/p/scite-config/downloads/list 2. Extract to C:\Program Files\AutoIt3\SciTE\ 3. Run C:\Program Files\AutoIt3\SciTE\SciTE.exe 4. Optional: Open %USERPROFILE%\SciTEUser.properties (same as selecting Options> Open User Options File in SciTE). Replace text with the included SciTEUser.properties to match colors in screen shots --- This is a dark theme for SciTE. Use: http://code.google.com/p/scite-config/ Screenshot:
-
Func To Control Windows Show/hide File Extensions
user52 replied to Lilla's topic in AutoIt Example Scripts
wow this is old. thanks formatted: #include-once Demo() ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with Windows Folder Options. ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Query or set Windows option to Show/Hide file extensions ; Syntax: _ShowHideFileExt( $iParm ) ; Parameter(s): $iParm - the action you want the function to perform ; -1 = query. Return the current setting for extensions. ; 0 = show. Assure extensions are showing, set if necessary. ; 1 = hide. Assure extensions are hiding, set if necessary. ; Requirement(s): None ; Return Value(s): On Success - returns the current setting (0=Show 1=Hide) ; On Failure - returns -1 and sets @error = 1 ; if there is an error reading the registry ; or if a bad parameter is passed. ; Author(s): Lilla Renfro Slater <[email protected]> ; Notes: For all versions of windows. Tested under Windows XP and 98. ; Under Windows XP, "Hide extensions for known files" option (default = enabled) ; is located on Control Panel > Folder Options > View tab. ; ; This function is helpful when using AutoIt Windows Matching with applications ; that show the file name on the title bar, such as: Notepad, Word, Excel, etc. ; ; For example, ; eula - Notepad (window title when extensions are set to hide) ; eula.txt - Notepad (window title when extensions are set to show) ; ; Example 1: This code assures that extensions are showing. ; _ShowHideFileExt(0) ; run('notepad.exe c:\windows\system32\eula.txt') ; WinWaitActive('eula.txt - Notepad') ; ; Example 2: This code adapts to the existing Show/Hide File Ext. setting ; $result = _ShowHideFileExt(-1) ; return the current setting ; run('notepad.exe c:\windows\system32\eula.txt') ; If $result = 0 Then ;extensions are showing ; $ext='.txt' ; Else ;extensions are hidden ; $ext='' ; EndIf ; WinWaitActive('eula' & $ext & ' - Notepad') ; ; Example 3: This code assures that extensions are showing, and ; restores the initial setting when done. ; Dim $query = -1, $show =0 , $hide = 1 ; $initial = _ShowHideFileExt($query) ; If $initial <> $show then ; $flag=1 ; _ShowHideFileExt($show) ; EndIf ; run('notepad.exe c:\windows\system32\eula.txt') ; WinWaitActive('eula.txt - Notepad') ; msgbox(0,'debug',"observe that Notepad's title line INCLUDES file extension") ; WinClose('eula.txt - Notepad') ; If $flag=1 then _ShowHideFileExt($initial) ;restore initial setting ; ;=============================================================================== Func _ShowHideFileExt($iParm) Local $key, $ret, $query = -1, $show = 0, $hide = 1 $key = RegRead( 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'HideFileExt' ) If @error Then $ret = -1 SetError( 1 ) Else Select Case $iParm = $show If $key = $hide Then ;hide => show RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 0) ;EnvUpdate() - doesn't appear to make a difference EndIf $ret = $show Case $iParm = $hide If $key = $show Then ;show => hide RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", 1) ;EnvUpdate() - doesn't appear to make a difference EndIf $ret = $hide Case $iParm = $query $ret = $key Case Else $ret = -1 SetError( 1 ) EndSelect EndIf Return $ret EndFunc ;==>_ShowHideFileExt Func Demo() ; toggle hide/show file extensions Local $query = -1, $show = 0, $hide = 1 For $i = 1 To 2 $initial = _ShowHideFileExt ($query) ;toggle setting for demo purposes If $initial = 1 Then $flag = 1 $now = _ShowHideFileExt (0) ElseIf $initial = 0 Then $flag = 1 $now = _ShowHideFileExt (1) EndIf Run('notepad.exe c:\windows\system32\eula.txt') If $now = 1 Then WinWaitActive('eula - Notepad') MsgBox(0, @scriptname, "observe that Notepad's title line does NOT include file extension") WinClose('eula - Notepad') ElseIf $now = 0 Then WinWaitActive('eula.txt - Notepad') MsgBox(0, @scriptname, "observe that Notepad's title line INCLUDES file extension") WinClose('eula.txt - Notepad') EndIf Next EndFunc ;==>Demo -
can you translate this? thanks mysql_insert_id() http://forums.mysql.com/read.php?38,98672,98868#msg-98868 CODEAfter executing your Insert-Command (C#, Connection is stored in conDBConnection):... string strSQLSelect = "SELECT @@IDENTITY AS 'LastID'"; MySqlCommand dbcSelect = new MySqlCommand(strSQLSelect, conDBConnection); MySqlDataReader dbrSelect = dbcSelect.ExecuteReader(); dbrSelect.Read(); int intCounter = Int32.Parse(dbrSelect.GetValue(0).ToString()); dbrSelect.Dispose(); conDBConnection.Close(); MessageBox.Show("Test: " + intCounter.ToString()); "SELECT @@IDENTITY AS 'LastID'"
-
any way to use mysql_insert_id()? mysql_insert_id(); http://www.php.net/mysql_insert_id $query = ""; $oconnectionobj.execute($query); thanks
-
thanks letting me know about PDFTK.exe http://www.pdfhacks.com/pdftk/pdftk-1.12.exe.zip (i know this is an old post) i can now update meta data using update_info, which is really just creating a copy of the pdf you specify with the meta data you specify ;command line code ;reads a.pdf meta data and outputs out.pdf with meta data specified in in.info pdftk.exe a.pdf update_info in.info output out.pdf ; contents of in.info InfoKey: Title InfoValue: this is the NEW title InfoKey: Author InfoValue: this is the NEW author InfoKey: Keywords InfoValue: these are the NEW keywords InfoKey: Subject InfoValue: this is the NEW subject! C:\pdftk-1.12>pdftk.exe __ a.pdf ___ update_info _ in.info ________ output __________ out.pdf _____________ ^run pdftk _ ^pdf src_ ^command ____ ^new meta data _ ^output command _ ^pdf save name with in.info meta data dump_data Reads a single, input PDF file and reports vari- ous statistics, metadata, bookmarks (a/k/a out- lines), and page labels to the given output filename or (if no output is given) to stdout. Does not create a new PDF. dump_data_fields Reads a single, input PDF file and reports form field statistics to the given output filename or (if no output is given) to stdout. Does not create a new PDF. update_info <info data filename | - | PROMPT> Changes the metadata stored in a single PDF's Info dictionary to match the input data file. The input data file uses the same syntax as the output from dump_data. This does not change the metadata stored in the PDF's XMP stream, if it has one. For example:
-
i've change it just a bit for what i needed. thanks ; toggle show/hide by clicking tray icon #include <Constants.au3> #include <GUIConstants.au3> Global $is_minimized = 0 Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "Toggle") $GUI = GUICreate("Minimize me", 460, 400) GUICtrlCreateLabel("Toggle show/hide by clicking tray icon", 125, 175) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE GuiSetState(@SW_HIDE) $is_minimized = 1 debug("$is_minimized: " & $is_minimized) EndSwitch WEnd Func Toggle() If $is_minimized = 1 Then GuiSetState(@SW_SHOW) $is_minimized = 0 Else GuiSetState(@SW_HIDE) $is_minimized = 1 EndIf debug("$is_minimized: " & $is_minimized) EndFunc Func debug($a) ConsoleWrite(@SEC & " " & $a & @CRLF) EndFunc
-
so... the solution to post #6 and #12 was what? was it...? $oQuery = _IEFormElementGetObjByName($oForm, "input_name_here") _IEAction($oQuery, "focus") Send("date_goes_here")oÝ÷ Ù©Ýjëh×6$oQuery = _IEFormElementGetObjByName($oForm, "submit_button") _IEAction($oQuery, "focus") Send("{Enter}")
-
i thought this was possible, cool
-
-hidden from taskbar -always on top -no tray icon -minimal desktop real estate ;~ HotKeySet("{ESC}", "_Exit") #NoTrayIcon #include <GUIConstants.au3> $w = 196 $h = 17 $Parent = GUICreate("") $gui = GUICreate("", $w, $h, (@DesktopWidth - $w - 3) / 2, @DesktopHeight - $h - 28 - 1, $WS_POPUP, $WS_EX_TOPMOST, $Parent) GUISetBkColor(0xffffff) GUISetFont(10, 400, 0, "arial") $date = GUICtrlCreateLabel("", 3, 1, 500, 500) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GuiSetState() Update() Func Update() While 1 $h = @HOUR $m = @MIN If $h > 12 Then $h = $h - 12 $m = $m & " PM" Else If $h = 12 Then $m = $m & " PM" Else $m = $m & " AM" EndIf EndIf GUICtrlSetData($date, GetDayOfWeek() & ", " & GetMonth() & " " & @MDAY & ", " & @YEAR & " " & $h & ":" & $m) Sleep(500) GUICtrlSetData($date, GetDayOfWeek() & ", " & GetMonth() & " " & @MDAY & ", " & @YEAR & " " & $h & " " & $m) Sleep(500) WEnd EndFunc Func _Exit() Exit EndFunc Func GetDayOfWeek() $a = @WDAY If $a = 1 Then Return "Sunday" If $a = 2 Then Return "Monday" If $a = 3 Then Return "Tuesday" If $a = 4 Then Return "Wednesday" If $a = 5 Then Return "Thursday" If $a = 6 Then Return "Friday" If $a = 7 Then Return "Saturday" EndFunc Func GetMonth() $a = @MON If $a = 1 Then Return "January" If $a = 2 Then Return "February" If $a = 3 Then Return "March" If $a = 4 Then Return "April" If $a = 5 Then Return "May" If $a = 6 Then Return "June" If $a = 7 Then Return "July" If $a = 8 Then Return "August" If $a = 9 Then Return "September" If $a = 10 Then Return "October" If $a = 11 Then Return "November" If $a = 12 Then Return "December" EndFunc
-
Selecting a Combo/Dropdown with Javascript
user52 replied to user52's topic in AutoIt General Help and Support
SOLVED!! the page uses inputs as combo dropdowns. it turns out there were hidden inputs that javascript was changing when you selected an option from the dropdown. SOLUTION: simply change the value of the visible AND hidden inputs using _IEFormElementSetValue() and voila! it works!! the inputs: Index,Id,Name,Type,Value,Label,Size,Maximum Length,State 23,inpt_status5,inpt_status,text,In Progress,,,, 24,hddn_status5,status,hidden,2,,,, 25,indx_status5,hidden,2,,,,, -
Tabbing With 2 Embedded IE Windows (Part 2)
user52 replied to user52's topic in AutoIt General Help and Support
-
Tabbing With 2 Embedded IE Windows (Part 2)
user52 replied to user52's topic in AutoIt General Help and Support
thank you lod3n i finally got the ie windows not to take away the focus of the gui. it was just a matter of setting $WS_CHILD right after setting it's parent using "SetParent". before after working code: #region #include <guiconstants.au3> ;~ #include <ie.au3> #include <IET2.0.6.au3> #include <misc.au3> HotKeySet("{ESC}", "_Exit") $gui = GUICreate("", 1230, 500) $Label_1 = GuiCtrlCreateLabel("", 10, 10, 600, 420) $Label_2 = GuiCtrlCreateLabel("", 620, 10, 600, 420) _IEErrorHandlerRegister() ;setup ie win (2x) $oIE1 = _IECreate("about:blank",0,0,1,0) $oIE1.AddressBar = 0 $oIE1.MenuBar = 0 $oIE1.StatusBar = 0 $oIE1.ToolBar = 0 $uID1 = Random(1000, 100000000) $oIE1.document.title = $uID1 WinWait($uID1, "", 7) $hoIE1 = WinGetHandle($uID1) $pid1 = WinGetProcess($hoIE1) $oIE2 = _IECreate("about:blank",0,0,1,0) $oIE2.AddressBar = 0 $oIE2.MenuBar = 0 $oIE2.StatusBar = 0 $oIE2.ToolBar = 0 $uID2 = Random(1000, 100000000) $oIE2.document.title = $uID2 WinWait($uID2, "", 7) $hoIE2 = WinGetHandle($uID2) $pid2 = WinGetProcess($hoIE2) ;embed DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE1, "int", -16, "long", $WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE1, "hwnd", $gui) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE1, "int", -16, "long", $WS_CHILD) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE2, "int", -16, "long", $WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE2, "hwnd", $gui) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE2, "int", -16, "long", $WS_CHILD) ;move $pos = ControlGetPos($gui, "", $Label_1) WinMove($hoIE1, "", $pos[0], $pos[1], $pos[2], $pos[3]) $pos = ControlGetPos($gui, "", $Label_2) WinMove($hoIE2, "", $pos[0], $pos[1], $pos[2], $pos[3]) ;nav _IENavigate($oIE1, "http://www.google.com/", 0) _IENavigate($oIE2, "http://images.google.com/", 0) ;show GuiSetState() $oIE1.visible=1 $oIE2.visible=1 #endregion WinActivate($gui) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd _Exit() Func _Exit() While ProcessExists($pid1) ProcessClose($pid1) WEnd Exit EndFunc Func dbg($msg) ConsoleWrite($msg & @CRLF) DllCall("kernel32.dll", "none", "OutputDebugString", "str", $msg) EndFunc -
Tabbing With 2 Embedded IE Windows (Part 2)
user52 posted a topic in AutoIt General Help and Support
continued from http://www.autoitscript.com/forum/index.php?showtopic=36890 here's a snippet of the code i'm using: #include <guiconstants.au3> ;~ #include <ie.au3> #include <IET2.0.6.au3> ;~ ProcessClose("iexplore.exe") HotKeySet("{ESC}", "_Exit") $gui = GUICreate("", 700, 700, -1, -1, 0) $Label_1 = GuiCtrlCreateLabel("", 10, 10, 670, 650) _IEErrorHandlerRegister() ;setup ie win $oIE1 = _IECreate("about:blank",0,0,1,0) $oIE1.AddressBar = 0 $oIE1.MenuBar = 0 $oIE1.StatusBar = 0 $oIE1.ToolBar = 0 $uID1 = Random(1000, 100000000) $oIE1.document.title = $uID1 WinWait($uID1, "", 7) $hoIE1 = WinGetHuID1) $pid1 = WinGetProcess($hoIE1) ;embed DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE1, "int", -16, "long", $WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE1, "hwnd", $gui) ;move $pos = ControlGetPos($gui, "", $Label_1) If IsArray($pos) Then WinMove($hoIE1, "", $pos[0], $pos[1], $pos[2], $pos[3]) EndIf ;show GuiSetState() $oIE1.visible=1 While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd _Exit() Func _Exit() While ProcessExists($pid1) ProcessClose($pid1) WEnd Exit EndFunc i was looking at the SetParent() function and was wondering how to synchronize the UISTATE of both windows. thanks -
i use these a lot ; exit script quickly HotKeySet("{ESC}", "_Exit") Func _Exit() Exit EndFuncoÝ÷ Ù«¢+ØìÕ()Õ¹ ÀÌØíµÍ¤(% ½¹Í½±]É¥Ñ ÀÌØíµÍµÀì I1¤(%±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¹½¹ÅÕ½Ðì°ÅÕ½Ðí=ÕÑÁÕÑÕMÑÉ¥¹ÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØíµÍ¤)¹Õ¹ Download DebugView (301 KB)
-
Tabbing through controls stopped working
user52 replied to orange's topic in AutoIt General Help and Support
i've had this trouble too http://www.autoitscript.com/forum/index.php?showtopic=36890 http://www.autoitscript.com/forum/index.php?showtopic=31539 http://www.autoitscript.com/forum/index.php?showtopic=32804 http://www.autoitscript.com/forum/index.php?showtopic=35742 -
this may help beginners as i tried to keep it simple uses PVW32Con.exe to convert image formats bitmap (*.bmp) to use 1. save PVW32Con.exe to C:\ 2. copy/open script using SciTE, run script by going to Tools> Go (or simply F5) 3. double click picture to set as wallpaper more about the dllcall used to change the wallpaper SystemParametersInfo #region #include <GuiTreeView.au3> #include <GUIConstants.au3> #include <GuiStatusBar.au3> #include <GuiCombo.au3> HotKeySet("{ESC}", "_Exit") Global $path = @MyDocumentsDir $DebugIt_KBdbg = 1 Global $Clicked = 0 Global Const $WM_NOTIFY = 0x004E Const $NM_FIRST = 0 Const $NM_CLICK = -2 Const $NM_DBLCLK = -3 Global Const $WM_COMMAND = 0x0111 $gui = GUICreate("Wallpaper", 670, 560, 192, 125, $WS_SYSMENU, 0) GUISetFont(10, 400, 0, "MS Sans Serif") $Done = GUICtrlCreateButton("Done", 520, 456, 97, 41, 0) $input_directory = GUICtrlCreateInput($path, 8, 8, 345, 25) $button_browse = GUICtrlCreateButton("Browse", 355, 8, 70) $List1 = GUICtrlCreateList("", 8, 38, 417, 410, -1, 0) $Up = GUICtrlCreateButton("Up", 8, 456, 49, 41, 0) $Down = GUICtrlCreateButton("Down", 64, 456, 49, 41, 0) $Preview = GUICtrlCreateGroup("Preview", 432, 8, 227, 207) $Preview_pic = GUICtrlCreatePic("C:\wallpaper.bmp", 440, 27, 210, 180) $Combo1 = GUICtrlCreateCombo("Center", 472, 222, 145, 24, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "Stretch|Tile") $button_default = GUICtrlCreateButton("", -100,-100,0,0) GUICtrlSetState(-1, $GUI_DEFBUTTON) Local $a_PartsRightEdge[2] = [600, -1] Local $a_PartsText[2] = ["", ""] $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) SearchDir() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUISetState(@SW_SHOW) #endregion While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button_browse $sTmpFile = FileSelectFolder("Select Folder:", "", 4, @MyDocumentsDir) If Not @error Then GUICtrlSetData($input_directory, $sTmpFile) SearchDir() EndIf Case $msg = $Done Exit Case $msg = $button_default List_DoubleClick() Case $msg = $Combo1 ChangeWallpaper(GetCurrentlySelected()) EndSelect WEnd Exit Func ChangeWallpaper($path_of_wallpaper) If Not FileExists($path_of_wallpaper) Then Return -1 EndIf $pos_slash = StringInStr($path_of_wallpaper, "\", 1, -1) $filename = StringTrimLeft($path_of_wallpaper, $pos_slash) $pos_dot = StringInStr($filename, ".", 1, -1) $filename_noext = StringTrimRight($filename, StringLen($filename) - $pos_dot + 1) dbg($pos_dot) dbg($path_of_wallpaper) dbg($pos_slash) dbg($filename) dbg($filename_noext) ;if jpg then covert jpg to bmp ShellExecuteWait("C:\PVW32Con.exe", """" & $path_of_wallpaper & """" & " -w --o C:\wallpaper.bmp", "", "", @SW_HIDE) ;write new file location to reg using type specified $sel = _GUICtrlComboGetCurSel($Combo1) If $sel = 0 Then ;center ;TileWallpaper=0 ;WallpaperStyle=0 RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", 0) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", 0) ElseIf $sel = 1 Then ;stretch ;TileWallpaper=0 ;WallpaperStyle=2 RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", 0) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", 2) ElseIf $sel = 2 Then ;tile ;TileWallpaper=1 ;WallpaperStyle=0 RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", 1) RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", 0) EndIf ;call dll using file location $SPI_SETDESKWALLPAPER = 20 $SPIF_UPDATEINIFILE = 1 $SPIF_SENDCHANGE = 2 DLLCall("user32.dll", _ "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", "C:\wallpaper.bmp", _ "int", BitOR($SPIF_UPDATEINIFILE,$SPIF_SENDCHANGE) ) EndFunc Func _Exit() Exit EndFunc Func dbg($a) ConsoleWrite($a & @LF) EndFunc Func GetCurrentlySelected() $sel = GUICtrlRead($List1) $image_path = $path & $sel If Not FileExists($image_path) Then Return -1 Else dbg("selected: " & $image_path) Return $image_path EndIf EndFunc Func UpdateStatusBar() _GUICtrlStatusBarSetText($StatusBar1, GetCurrentlySelected(), 0) EndFunc Func SetCurrentlySelected() GUICtrlSetImage($Preview_pic, GetCurrentlySelected()) EndFunc Func SearchDir($dir="") ;clear List GUICtrlSetData($List1, "") ;check for blank dir If $dir = "" Then $dir = GUICtrlRead($input_directory) Else Return EndIf ;check for trailing slash $a = StringTrimLeft($dir, StringLen($dir) - 1) dbg($a) If $a <> "\" Then $dir = $dir & "\" EndIf ;check dir exists If Not FileExists($dir) Then Return -1 EndIf ;update global path $path = $dir ;search ;search for database directory Local $search = FileFindFirstFile($dir & "*.*") ;not found If $search = -1 Then MsgBox(0, "", "nothing found in: " & $dir & "*.*") Return 0 EndIf ;found While 1 $found = FileFindNextFile($search) If @error Then ExitLoop Else $a = FileGetAttrib($dir & $found) ;folder found If StringInStr($a, "D", 1) <> 0 Then ; Else GUICtrlSetData($List1, $found) EndIf EndIf WEnd ;close search FileClose($search) EndFunc Func List_Click() SetCurrentlySelected() UpdateStatusBar() EndFunc Func List_DoubleClick() ChangeWallpaper(GetCurrentlySelected()) EndFunc Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0xFFFF) Local $hCtrl = $lParam Local Const $LBN_ERRSPACE = (-2); Local Const $LBN_SELCHANGE = 1; Local Const $LBN_DBLCLK = 2; Switch $nID Case $List1 Switch $nNotifyCode Case $LBN_SELCHANGE List_Click() Case $LBN_DBLCLK List_DoubleClick() EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
-
here's the MessageBox Function http://msdn.microsoft.com/library/en-us/wi.../messagebox.asp
-
IE.au3 V2.1-0 (was IE.au3 T2.0-6 pre-release)
user52 replied to DaleHohm's topic in AutoIt Example Scripts
something like this? $TIMEOUT = 5000 ;5 second timeout Case $s_action = "refresh" $o_object.document.execCommand ("Refresh") For $i = 0 To 5 _IELoadWait($o_object, 0, $TIMEOUT / 5) Next SetError($_IEStatus_Success) Return 1 -
IE.au3 V2.1-0 (was IE.au3 T2.0-6 pre-release)
user52 replied to DaleHohm's topic in AutoIt Example Scripts
DaleHohm, would it be possible to set a timeout for the _IEAction()s above? i see that 'refresh' has an _IELoadWait($o_object), but the others i don't know. my script dies when the site is being slow and the page doesn't immediately respond thanks -
Get index of the checkbox that was changed in ListView
user52 replied to user52's topic in AutoIt General Help and Support
any thoughts? ; Events - ListView #include <GuiConstants.au3>;Inclusion file for the GUI interface controls #include <GuiListView.au3> #region Global variables Global $ListView Global Const $WM_NOTIFY = 0x004E Global Const $DebugIt = 1 ;ListView Events Global Const $NM_FIRST = 0 Global Const $NM_CLICK = ($NM_FIRST - 2) Global Const $NM_DBLCLK = ($NM_FIRST - 3) #endregion End Global variables Opt("WinTitleMatchMode", 2) $main_GUI = GUICreate("GuiRegisterMsg Test", 225, 400, 300, 10, BitOR($WS_THICKFRAME, $WS_SIZEBOX)) $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280, BitOR($LVS_SORTASCENDING, $LVS_SINGLESEL)) _GUICtrlListViewSetColumnWidth ($ListView, 0, 100) _GUICtrlListViewSetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) GUISetState() ;Register WM_NOTIFY events GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $msg = GUIGetMsg() Switch $msg ;----------------------------------------------------------------------------------------- ;This case statement exits and updates code if needed Case $GUI_EVENT_CLOSE Exit ;----------------------------------------------------------------------------------------- ;put all the misc. stuff here Case Else ;;; EndSwitch WEnd Func ListView_Click() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("$NM_CLICK") ;---------------------------------------------------------------------------------------------- EndFunc ;==>ListView_Click Func ListView_DoubleClick() ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint ("$NM_DBLCLK") ;---------------------------------------------------------------------------------------------- MsgBox(0,"Double Clicked", _GUICtrlListViewGetItemText ($ListView, _GUICtrlListViewGetSelectedIndices($ListView))) EndFunc ;==>ListView_DoubleClick ; ; WM_NOTIFY event handler Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) ;NMHDR (hwndFrom, idFrom, code) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect $tagNMHDR = 0 $event = 0 $lParam = 0 EndFunc ;==>WM_Notify_Events Func _DebugPrint($s_text) ConsoleWrite( _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF) EndFunc ;==>_DebugPrint