Leaderboard
Popular Content
Showing content with the highest reputation on 07/15/2015 in all areas
-
Func _Retailer($chn) $file = "\excel.xls" Local $oApplM = _Excel_Open(False) Local $oExcelM = _Excel_BookOpen($oApplM, $file) Local $aArrayM = _Excel_RangeRead($oExcelM, Default, $oExcelM.ActiveSheet.Usedrange.Columns("A:D"), 1, True) For $y = 1 To Ubound($aArrayM) - 1 If $chn = $aArrayM[$y][2] Then Local $ret = $aArrayM[$y][1] EndIf Return $ret EndFuncTry this.. You have to watch Global and Local Variables and don't use the same name for different Variables. 8)1 point
-
Wonderful explanation, thank you. The following is definitely not criticism; just an observation from the pits. I am curious why some of the Examples in the Help file employ techniques that seem advanced for the intended audience (Help users). Usually the main topic of the Example (e.g., a function) is demonstrated in a straightforward manner but some of the surrounding code almost seems designed to challenge the reader and expose him or her to more advanced techniques. While I sometimes enjoy and appreciate the exercise in deciphering "what's going on" in an example, other times I'd prefer to not be distracted from the main topic. I guess the question comes down to, "Should an Example be used as an opportunity to introduce techniques unrelated to understanding the specific topic?" For example, being an infrequent user of AutoIt my techniques tend not to evolve. So the code I would have written to create the temporary file would have been elementary. Since creating the temp file for reading is just to support the main topic using FileOpen I would've put the following in the main Example function and not employed another function: ; Create a temporary file to read data from. If FileExists ($sFilePath) Then Return MsgBox($MB_SYSTEMMODAL, "", "The temporary file already exists. Bailing out.") Else If Not FileWrite ($sFilePath,"This is an example of using FileOpen.") then Return MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") EndIf I chuckled as I wrote the above code because it demonstrates that you taught me a new technique about using Return followed by an action, whereas my code previously would have been a couple lines longer. But it is at my level of understanding, requiring no deciphering while I pay attention to the main goal of learning how to use FileOpen. I admire the elegance of your FileCreate function, the use of Boolean logic, etc., and hope to someday reel off similarly elegant code. Thank you!1 point
-
Yes, there is. You can use WinHttp.au3 UDF or utilize several UDFs recently written by brilliant forum member Ward. Go through examples forum.1 point
-
Seemingly unrelated question: do you use Logitech mice/keyboards drivers on the failling machine? If yes, try temporarily disabling that.1 point
-
It Opens the Window that's all that it does.1 point
-
http://www.regexr.com/ - this is also a good website to create and test regex online!1 point
-
stringregexp to get part of file path
jvanegmond reacted to guinness for a topic
It's not exactly trancexx's expression for the PCRE engine, but it's pretty close and really only for a visualisation of the regex: http://regexper.com/#.*%3F\\AutoIt\s(.*)\\.*%3F1 point -
Try something like this here: #include <GDIPlus.au3> Global Const $sFile = FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.bmp;*.gif)", $FD_FILEMUSTEXIST) If @error Then Exit ;exit when dialog has been canceled _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) If Not $hImage Or @error Then Exit + (_GDIPlus_Shutdown()) ;exit when the image is not supported by GDI+ (strange syntax but it works :-) Global $aDim = _GDIPlus_ImageGetDimension($hImage) Global Const $hCanvas = _GDIPlus_ImageGetGraphicsContext($hImage) ;get the canvas _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;set antialiasing for the canvas to increase quality Global Const $hPen = _GDIPlus_PenCreate(0xFFFF0000) ;create a red pen (ARGB format) _GDIPlus_GraphicsDrawLine($hCanvas, 0, 0, $aDim[0], $aDim[1], $hPen) ;draw a line from 0,0 to w,h _GDIPlus_PenSetColor($hPen, 0xFF00FF00) ;change the pen color to green _GDIPlus_GraphicsDrawEllipse($hCanvas, 0, 0, $aDim[0], $aDim[1], $hPen) ;draw an ellipse _GDIPlus_PenSetColor($hPen, 0xFF0000FF) ;change the pen color to blue _GDIPlus_GraphicsDrawRect($hCanvas, $aDim[0] / 2 - 10, $aDim[1] / 2 - 10, 20, 20, $hPen) ;draw a rectangle in the center Global Const $sFileSave = @ScriptDir & "\Modified.jpg" _GDIPlus_ImageSaveToFile($hImage, $sFileSave) ;save the modified image ;clean up the gdiplus resources _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ShellExecute($sFileSave)1 point
-
I like to use http://regexper.com/ for visuals of a regex, which by the way @TheSaint, my regex can be tweaked to http://regexper.com/#(%3F%3A\|[ |]\|) What's that saying? So many ways to love a cat? =)1 point
-
Apart from the music being a little annoying, this is pretty cool (thought about doing a demo myself in PHP + MySQL + RESTful API (limited library) and AutoIt + WinHTTP UDF) I do question your use of hashing the password with MD5, but then it is only a demo after all.1 point
-
Yeah, I am also using it, the code generation feature is amazing (though not have for AutoIt, but not a problem).1 point
-
How do you write comments in your source code? With a full-stop or without?
Xandy reacted to jvanegmond for a topic
Programming is hard enough as it is without meticulously watching your grammar in comments. They should be a quick way to show your thoughts as you were writing the code. Why you're confused is that sometimes you do documentation of your code in comments. In C#, you can create neat summaries at the start of your function. You nearly always write those once the function prototype is complete and stable and you need to take your time to write it proper. Then you should also watch grammar.1 point -
WUT? Don't ever let me catch you remarking without punctuation! Outragious.1 point
-
[SOLVED] Am I using $WS_EX_MDICHILD correctly?
Xandy reacted to jaberwacky for a topic
K, I use the helpfile and think it's great. But Sometimes I come across somethings that throw me for a loop. I really should report them as I come across them though.1 point -
Thanks. I wrote the example or should I say re-wrote1 point
-
Help File/Documentation Issues. (Discussion Only)
jaberwacky reacted to guinness for a topic
Ticket created: https://www.autoitscript.com/trac/autoit/ticket/3081#ticket1 point -
No, it won't work on Macs, at least a Mac running OSX, it's as simple as that.1 point
-
I don't have the source anymore. The server my projects were hosted on was deleted and with it every script and documentation on it. I won't bother rewriting this, though an Assembler is a trivial program, the debugger is not.1 point
-
stringregexp to get part of file path
ViciousXUSMC reacted to trancexx for a topic
This is for me? The function replaces original string with smallest portion "(?U)(.*)" of it that's preceded with any number of characters and then backslash, string "AutoIt" plus horizontal whitespace and followed with backslash and whatever. ".*?\\AutoIt\h(?U)(.*)\\.*?" ____ _ _____ _ ____ _ __ | | | | | | | / | | | \ \ \__________ / | | whitespace \ \ \ anything | \ | backslash \ | \ wanted portion \ backslash \ whatever AutoIt1 point -
Buy RegExBuddy - I use it daily while working with the forum php (regex everywhere). It's amazing. Wish they'd make it for the mac.1 point
-
Whoops, fixed that. Also good to hear that I might have inspired you!1 point
-
If you run Windows on Mac then IE would be working too. AutoIt can be run on Windows only, you know that?1 point
-
Need help Creating an Application Switcher
tweakster2010 reacted to Melba23 for a topic
GezJohnJones, Delighted I could help. And to anyone else reading, this thread is an excellent example of how to get focused advice. Post some code which shows you have made an effort to solve the problem yourself and explain exactly why it does not work as expected - that way we have something with which to work and more importantly the knowledge that the OP is not just expecting us to do all the work. M231 point -
This program simply solves sodoku using backtracking. If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. SudokuSolver_source.zip1 point
-
Hey folks! I bring this JSON generator I made, which uses a syntax that reminds OOP a little. Here's an example: #include "JSONgen.au3" $oJson = New_Json() ; Let's add some stand-alone elements Json_AddElement($oJson, "test") ; A string Local $aArray[2] = ['hai', 'halo'] Json_AddElement($oJson, $aArray) ; An array ; Let's add some associative elements Json_AddElement($oJson, "hey", 2.55) Json_AddElement($oJson, "delete", "me") ; We will delete this one Json_AddElement($oJson, "hoo", True) Json_AddElement($oJson, "edit", "this") ; And edit this one ; Let's do some editing Json_DeleteElement($oJson, "delete") ; Deleting that one Json_EditElement($oJson, "edit", "that") ; Editing that one ; Let's now add an associated (non-associative) array :) Local $aArray[2] = ['hey', 'bye'] Json_AddElement($oJson, 'array', $aArray) ; Now we get the JSON $sTheJsonCode = Json_GetJson($oJson) MsgBox(0, "Json code", $sTheJsonCode)This will show: Includes help. License: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/) Download: https://www.autoitscript.com/forum/files/file/345-jsongen-json-generator/1 point
-
Try this modification of your script. It uses 2 arrays, one to hold the programs to run, the other holds the control IDs of the checkboxes created. #include <Array.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GUIConstants.au3> Local $arr[6] ; Make room for three elements ;Assign some data $arr[0] = "Notepad.exe" $arr[1] = "Calculator.exe" $arr[2] = "Notepad.exe" $arr[3] = "Calculator.exe" $arr[4] = "Notepad.exe" $arr[5] = "Notepad.exe" Global $ControlIDs[UBound($arr)] _ArrayDisplay($arr) GUICreate("Installs for Computers", 600, 300) GUICtrlCreateLabel("Installs for Computers", 30, 10) For $item = 0 to UBound($arr) -1 $ControlIDs[$Item] = GUICtrlCreateCheckbox($arr[$item], 10, $item * 20, 120, 20) ; create checkboxes and store their control IDs Next $okbutton = GUICtrlCreateButton("OK", 70, 275, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $okbutton MsgBox(0, "GUI Event", "The Installs will now begin") For $Loop = 0 To UBound($arr) - 1 ; Loop through the checkboxes If GUICtrlRead($ControlIDs[$Loop]) = $GUI_CHECKED Then ; Find if it's checked RunWait(@ComSpec & ' /c start ' & $arr[$Loop], '', @SW_HIDE) ; run the program stored in the same position in the $arr array EndIf Next Exit Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") ExitLoop EndSelect WEnd1 point