Leaderboard
Popular Content
Showing content with the highest reputation on 03/04/2016 in all areas
-
How to Format Scripts and Code
krasnoshtan reacted to Jon for an article
There are three ways you can posts scripts, these are: Inline code Attachments Download system Each has different advantages and disadvantages. In general you should use: Inline code - for short code snippets Attachments - for more complicated code larger than a page. Downloads system - for projects or complex libraries Inline Code Best for entering short snippets of code Easiest for other users to see May be accidentally modified by forum upgrades or when re-editing your post - it's happened before... Inline code is entered using the "Add Code" button in the toolbar and after posting appears with syntax highlighting like this: ; This is some AutoIt code MsgBox(4096, "Message", "Hello there!") Code over around 50 lines will appear in a scrollable box. At this point it becomes more difficult for other users to work with and you should consider an attachment instead. Attachments Best for long pieces of code, entire programs, or multiple files Unlikely to be accidentally lost or modified by forum upgrades or when re-editing your post Counts against your global attachment allocation Can be seen in the "username / My Attachments" part of your profile, along with the number of downloads Multiple attachments can be added to a post. As attachments are stored as complete files in the filesystem, they are more robust than inline code snippets. Downloads System Best for very long and complicated projects or libraries that are of significant use to the community Uses a different part of the forum that is optimised for file downloads and features screenshots, change logs, download counts, etc. Does not count against your global attachment allocation This can be accessed here: Downloads System.1 point -
MS Word Find and Replace Hyperlinks.
dmob reacted to Messy_Code_Guy for a topic
Issue solved! I was not doing a search for the text I wanted to use as a Range marker. This code worked for me: #include <MsgBoxConstants.au3> #include <Word.au3> Local $oWord = _Word_Create() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", _ "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oDoc = _Word_DocOpen($oWord, @ScriptDir & "\test.docx", Default, Default, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", _ "Error opening '.@ScriptDir & "\test.docx." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $emailold = "billy.bob@somecompany.com" $emailnew = "mailto:john.boy@somecompany.com" Local $oRange = _Word_DocFind ( $oDoc , $emailold ); this is what was missing from my code. The word doc find. _Word_DocLinkAdd($oDoc, $oRange, $emailnew,Default,Default,"john.boy@somecompany.com")1 point -
Try replacing your _ExcelRAngeCopyPaste line with this: $URL = _Excel_RangeRead ($oWorkbook1, Default, "C1") Make use of Msgbox to display your variables and it will help you troubleshoot any issues you are having.1 point
-
random question about random()
LarsJ reacted to argumentum for a topic
Solution: read the help file ! If @Compiled Then Exit MsgBox(0, "Master - RandomTest", "please run this from the editor", 10) #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $iManyTesters = 10 ; how many I run but they all give the same random number ! Global $iRandom = 0 Global $SEC = @SEC If $CmdLine[0] Then AutoItWinSetTitle("RandomTester # " & $CmdLine[1]) SRandom(@AutoItPID) ; <--- solution: read the help file ! While 1 If $SEC <> @SEC Then $SEC = @SEC $iRandom = Random(0, 4, 0) ControlSetText("Master - RandomTest", "", "Edit" & $CmdLine[1], StringRight("00" & $CmdLine[1], 2) & ") " & $iRandom) EndIf Sleep(10) WEnd Exit EndIf Global $n, $Form = GUICreate("Master - RandomTest", 300, 50 + (24 * $iManyTesters) - 46) For $n = 1 To $iManyTesters GUICtrlCreateInput("Input" & $n, 2, 2 + (24 * $n) - 24, 296, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) GUICtrlSetFont(-1, 15, 400, 0, "Terminal") Next GUISetState(@SW_SHOW) Global $aTesters[$iManyTesters + 1] $aTesters[0] = $iManyTesters $SEC = @SEC Do Sleep(10) Until $SEC <> @SEC For $n = 1 To $iManyTesters $aTesters[$n] = Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '" ' & $n) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() For $n = 1 To $iManyTesters ProcessClose($aTesters[$n]) Next Exit EndSwitch WEnd1 point -
Please try http://regex101.com/ it's a very good PCRE regexp testing and debugging resource.1 point
-
But that's not it. When you start Windows you actually start a program (I'll underline it from now on). That program is the only thing that ever "touches" your computer's CPU. Then that program creates interface for you (the user) to start application(s). At the same time the program creates time slots in which it then puts tasks. Time slot is a portion of overall time. The program doesn't advertise how big one time-slot is. It can be two ticks, 1 millisecond, 6 instructions, or whatnot. This is done to create impression that it runs more things at the same time. It actually runs only one thing at any given time, but switches too fast for you to notice it. When mentioned applications are "started" the program puts it into one time slot. Sometimes these slots are divided into sub-slots (working threads) of a process. When one time-slot is "active" the program takes binary data (opcodes) from the application and "pushes" it to the CPU onto its behalf. Race condition can occur, for example, if the program has bug and allows two slots to overlap. This usually ends up with BSOD. More common and usual case of race condition occurring is when programmer asks the program to create sub-slots (threads) and then access the same addresses from two different sub-slots. Because the program didn't say for how long one sub-slot will run, it can happen that one sub-slot runs for longer time than another before execution is switched to another sub-slot. First slot might have executed more instructions. The problem for the code in another sub-slot is that the code from the first one may have changed data at the shared addresses. Then that other thread continues, but has no idea that the data it works on has been changed by someone else. Now, that is it in layman's terms.1 point
-
Projects need MYSQL , I should take any UDFs?
Rechard_Long reacted to binhnx for a topic
@mLipok: Yes, its not only for mySQL (1), and he can even use an older mySQL driver (2) with your UDF but I need some simple words (bind to the context we are discussing) so he can understand, especially he cannot read English well. @Rechard_Long: If you use @mLipok UDF, read his example so you will know how to retrieve the data. Take a look at the function _Example_1_RecordsetToConsole. Instead of using _ADO_Recordset_ToArray you can use _ADO_Recordset_ToString so you can use the result directly in GUICtrlCreateLabel1 point -
GroupBox click
Miloud reacted to InunoTaishou for a topic
Here's one way to do it. You can remove the WM_MOUSEMOVE if you just want it to color the group control when you click in the group control. If you like it coloring the group control if the mouse is in that control then remove the WM_LBUTTONDOWN. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Dialog", 280, 203, 259, 217) $Group1 = GUICtrlCreateGroup("group1", 8, 8, 129, 185) GUICtrlSetBkColor(-1, 0xA0A0A4) $Input1 = GUICtrlCreateInput("Input1", 24, 48, 97, 21) $Button3 = GUICtrlCreateButton("Button1", 32, 88, 75, 25) $Group2 = GUICtrlCreateGroup("group2", 144, 8, 129, 185) GUICtrlSetBkColor(-1, 0xA0A0A4) $Input2 = GUICtrlCreateInput("Input2", 160, 48, 97, 21) $Button4 = GUICtrlCreateButton("Button2", 168, 88, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_MOUSEMOVE, WM_MOUSEMOVE) GUIRegisterMsg($WM_LBUTTONDOWN, WM_LBUTTONDOWN) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_LBUTTONDOWN($hWndFrom, $iMsg, $wParam, $lParam) Local $cursor_info = GUIGetCursorInfo($hWndFrom) If (@error) Then Return $GUI_RUNDEFMSG Switch ($hWndFrom) Case $Form2 Switch ($cursor_info[4]) Case $Group1 GUICtrlSetBkColor($Group1, 0x3A6EA5) GUICtrlSetBkColor($Group2, 0xA0A0A4) Case $Group2 GUICtrlSetBkColor($Group1, 0xA0A0A4) GUICtrlSetBkColor($Group2, 0x3A6EA5) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_LBUTTONDOWN Func WM_MOUSEMOVE($hWndFrom, $iMsg, $wParam, $lParam) Local Static $set_color_for = 0 Local $cursor_info = GUIGetCursorInfo($hWndFrom) If (@error) Then Return $GUI_RUNDEFMSG Switch ($hWndFrom) Case $Form2 Switch ($cursor_info[4]) Case $Group1 If ($set_color_for = $Group2 Or Not $set_color_for) Then GUICtrlSetBkColor($Group1, 0x3A6EA5) GUICtrlSetBkColor($Group2, 0xA0A0A4) $set_color_for = $Group1 EndIf Case $Group2 If ($set_color_for = $Group1 Or Not $set_color_for) Then GUICtrlSetBkColor($Group1, 0xA0A0A4) GUICtrlSetBkColor($Group2, 0x3A6EA5) $set_color_for = $Group2 EndIf Case Else If ($set_color_for = $Group1) Then GUICtrlSetBkColor($Group1, 0xA0A0A4) ElseIf ($set_color_for = $Group2) Then GUICtrlSetBkColor($Group2, 0xA0A0A4) EndIf $set_color_for = 0 EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOUSEMOVE1 point -
Requesting permission from the AutoIt Team regarding Freenode IRC
argumentum reacted to guinness for a topic
We discussed this before hence why Chat was created. So go ahead do as you please, but I really doubt anyone will use it. I would however advise you direct people here to write their solution and share the knowledge.1 point -
Requesting permission from the AutoIt Team regarding Freenode IRC
argumentum reacted to iamtheky for a topic
IRC is good if you need to download something, and find yourself in the late 1990s.1 point