
timbo
Active Members-
Posts
24 -
Joined
-
Last visited
Everything posted by timbo
-
Solved! Thank you Funkey! (also to "wraithdu" and "guinness" for confirming it's a local issue) The "SQLite.dll.au3" in the "Beta\Include" dir is only 1KB, as opposed to the 2,273KB one from the current release. That said, it looks like the "SQLite.au3" packaged with the Beta has been updated, so I presume I should keep this one? My apologies for shouting BUG somewhat prematurely, but does this mean "wraithdu" and "guinness" both have the SQLite DLL loaded (in @SystemDir), or they have previously copied "SQLite.dll.au3" to the Beta directory and forgot that it was required on a clean install? I have no doubt the developers have their reasons for keeping the full "SQLite.dll.au3" out of the Beta release, but could someone enlighten me as to why? Or is it simply to keep the footprint small, I know 2MB is massive compared to the core AutoIt files. Thanks again. -Timbo
-
Hmm, well I'm new to Windows 7 too - so I won't rule that out as the problem. That said, it's a clean install, just over a week old, so I don't image it's too clogged up with conflicting files and applications. This is the console output when I run it under v3.3.6.1 x64: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\test.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>17:49:41 Starting AutoIt3Wrapper v.2.0.3.0 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3 +>17:49:42 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\test.au3" _SQLite_LibVersion=3.6.22 +>17:49:44 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 4.621 This is the console output when I run it under v3.3.7.23 (beta) x64 (via Alt-F5): >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\test.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3\beta" /UserParams +>17:48:18 Starting AutoIt3Wrapper v.2.0.3.0 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3\Beta +>17:48:19 AU3Check ended.rc:0 >Running:(3.3.7.23):C:\Program Files (x86)\AutoIt3\Beta\autoit3_x64.exe "C:\test.au3" !>17:48:22 AutoIT3.exe ended.rc:-1 >Exit code: -1 Time: 5.238 Happy to continue using v3.3.6.1, though surely I'm not the only one seeing this, or am I...? -Timbo
-
Hello all, It's the first time I've tried installing a Beta version of AutoIt, so I'm not sure of the best way to notify the powers that be of a potential bug. It seems the SQLite works fine in v3.3.6.1 x64, but not in v3.3.7.23 (beta) x64...? I tested using the sample code in the help file: #include <SQLite.au3> #include <SQLite.dll.au3> Local $sSQliteDll $sSQliteDll = _SQLite_Startup() If @error Then MsgBox(16, "SQLite Error", "SQLite3.dll Can't be Loaded!") Exit -1 EndIf MsgBox(0, "SQLite3.dll Loaded", $sSQliteDll) ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Shutdown() I'm running Windows 7 Ultimate x64. -Timbo
-
Did you happen to see this part of the code: Global $WorkBook1="" ;e.g. "C:\sample1.xls" (Optional) Global $SheetName1="" ;e.g. "Sheet1" (Optional) Global $WorkBook2="" ;e.g. "C:\sample2.xls" (Optional) Global $SheetName2="" ;e.g. "Sheet1" (Optional) It says they're "Optional" as that is an example script, so it will generate data to copy on the fly. If you specify your own files, it will use them. So, try adding the full path to your workbook "template" into the "$WorkBook1" variable (as well as adding the sheet name that you would like copied into the "$SheetName1" variable), then add the full path to the workbook "MSR..." into the "$WorkBook2" variable (with sheet name to copy to in the "$SheetName2" variable). I presume that if you can generate the "MSR..." file name for use with WinActivate, then you should be able to specify it for the "$WorkBook2" variable. I know you're experienced with WinActivate, and thus would like to use it, but using the Excel API is the most reliable way to do it (possibly the only way). "Paste Special" only works within the one instance of Excel (As you've noted in a previous post). One instance means WinActivate can't select second spreadsheet cause (I believe) Excel changes the window title on the fly as you switch between files. So, as much as you might like to use WinActivate, it might be time to investigate another method. Also, which "Paste Special" option are you trying to use; Formulas, Values, Formats...? My script is using Values. -Timbo
-
I like it! I've been using my way (subtracting hours, minutes, seconds) for years thinking that there had to be a better way (without using "_date" functions), now I know... -Timbo
-
Hi there, I've knocked together something that may help you. As Water said, you should check out the "_Excel" functions in the help file, they really will help you going further. That said, I actually have done things the hard way and didn't use any of the "_Excel" functions (I have my reasons). But you should really use the "_Excel" functions unless you have a good understanding of VBA (Visual Basic for Applications). Try this (no need to change/add anything, just copy-paste into an au3 file and run it): Global $WorkBook1="" ;e.g. "C:\sample1.xls" (Optional) Global $SheetName1="" ;e.g. "Sheet1" (Optional) Global $WorkBook2="" ;e.g. "C:\sample2.xls" (Optional) Global $SheetName2="" ;e.g. "Sheet1" (Optional) Global $oExcel = ObjCreate("Excel.Application") $oExcel.visible=1 If $WorkBook1="" Then ;If a workbook was not specifed above ($WorkBook1), then create a new workbook for example purposes $oExcel.WorkBooks.Add ;Add a new blank workbook to excel Sleep(1000) For $Row = 1 To 10 ;Make some sample data For $Column = 1 To 10 $oExcel.Activesheet.Cells($Row, $Column).Value=($Row*$Column) Next Next Sleep(1000) Else ;If a workbook was specifed above ($WorkBook2), then open it and select the appropriate sheet $oExcel.WorkBooks.Open($WorkBook1) Sleep(1000) $oExcel.Sheets($SheetName1).Select Sleep(1000) EndIf $oExcel.Activesheet.Cells.Copy ;Copy the content from the first Workbook Sleep(1000) If $WorkBook2="" Then ;If a workbook was not specifed above ($WorkBook2), then create a new workbook for example purposes $oExcel.WorkBooks.Add Sleep(1000) Else ;If a workbook was specifed above ($WorkBook2), then open it and select the appropriate sheet $oExcel.WorkBooks.Open($WorkBook2) Sleep(1000) $oExcel.Sheets($SheetName2).Select Sleep(1000) EndIf $oExcel.ActiveSheet.Cells(1, 1).Select Sleep(1000) $oExcel.ActiveSheet.Cells(1, 1).PasteSpecial(0xFFFFEFBD) ;Paste Values the copied content from the first Workbook into the second Workbook $oExcel.ActiveWorkBook.SaveAs(@ScriptDir&"\CopiedSheet_"&@YEAR&@MON&@MDAY&"_"&@HOUR&@MIN&@SEC&".xls") ;Save the file in the same folder as this script ;$oExcel.ActiveWorkBook.Save ; Alternately you could just save the existing file The above is an example, and as a result it has alot of unessesary code. The following is a stripped down version of the code above: Global $WorkBook1="" ;e.g. "C:\sample1.xls" (Required) Global $SheetName1="" ;e.g. "Sheet1" (Required) Global $WorkBook2="" ;e.g. "C:\sample2.xls" (Required) Global $SheetName2="" ;e.g. "Sheet1" (Required) Global $oExcel = ObjCreate("Excel.Application") $oExcel.visible=1 $oExcel.WorkBooks.Open($WorkBook1) $oExcel.Sheets($SheetName1).Select $oExcel.Activesheet.Cells.Copy ;Copy the content from the first Workbook $oExcel.WorkBooks.Open($WorkBook2) $oExcel.Sheets($SheetName2).Select $oExcel.ActiveSheet.Cells(1, 1).PasteSpecial(0xFFFFEFBD) ;Paste Values the copied content from the first Workbook into the second Workbook $oExcel.ActiveWorkBook.SaveAs(@ScriptDir&"\CopiedSheet_"&@YEAR&@MON&@MDAY&"_"&@HOUR&@MIN&@SEC&".xls") ;Save the file in the same folder as this script ;$oExcel.ActiveWorkBook.Save ; Alternately you could just save the existing file Now don't tell me I should have used "With $oExcel ... EndWith". I thought the code would be easier to understand without it. Hope this helps. Edit: This script will open Excel and the WorkBooks for you, you shouldn't have your Excel files open when you run these. -Timbo
-
Hi there, Try this: Local $time=@HOUR-1 If $time<0 Then $time=23 ConsoleWrite("Time: "&$time&@CRLF) Or If @HOUR=0 Then ConsoleWrite("Time: 23"&@CRLF) Else ConsoleWrite("Time: "&(@HOUR-1)&@CRLF) EndIf Hope that works for you. -Timbo
-
ListView SortItems - Prevent toggling of Asc/Desc
timbo replied to timbo's topic in AutoIt General Help and Support
Hello again, Wouldn't you know it, 30 mintutes after I post I solved it... I can't say I entirely understand my solution, but it seems to work. I encourage anyone with the knowledge to clarify (or correct) my solution. I noticed that when you call "_GUICtrlListView_RegisterSortCallBack", it generates an array which is updated in subsequent "_GUICtrlListView_SortItems" calls. The array is shown below: $aListViewSortInfo[$iIndex][1] = $hWnd ; Handle/ID of listview $aListViewSortInfo[$iIndex][2] = _ DllCallbackRegister("__GUICtrlListView_Sort", "int", "int;int;hwnd") ; Handle of callback $aListViewSortInfo[$iIndex][3] = -1 ; $nColumn $aListViewSortInfo[$iIndex][4] = -1 ; nCurCol $aListViewSortInfo[$iIndex][5] = 1 ; $nSortDir $aListViewSortInfo[$iIndex][6] = -1 ; $nCol $aListViewSortInfo[$iIndex][7] = 0 ; $bSet $aListViewSortInfo[$iIndex][8] = $fNumbers ; Treat as numbers? $aListViewSortInfo[$iIndex][9] = $fArrows ; Use arrows in the header of the columns? $aListViewSortInfo[$iIndex][10] = $hHeader ; Handle to the Header When "SortItems" is called the array item "$aListViewSortInfo[$iIndex][7]" gets set to 0, I have no idea what that does, but if you stop that from happening, it won't toggle the Asc/Desc. So, my poorly designed solution consists on the following: 1) Setup the usual sorting methods for your listview 2) Copy the "_GUICtrlListView_SortItems" function from the "GuiListView.au3" include, paste it into your own script, and change the function name to avoid a conflict 3) Delete (or comment out) the reference to $aListViewSortInfo[$iIndex][7] = 0 ; $bSet 4) Call the usual "_GUICtrlListView_SortItems" on listview heading clicks, and call the renamed function when calling from your own function Hope this helps others, I also hope I haven't made a rookie mistake by incorrectly updating code (of which I have no clue on how it works). (Edit: Decided to add my modified function below:) Func _GUICtrlListView_SortItems_NoToggle($hWnd, $iCol, $nSortDir=0) ;$nSortDir: 1=Ascending, -1=Descending, 0=Current Local $iRet, $iIndex, $pFunction, $hHeader, $iFormat If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) For $x = 1 To $aListViewSortInfo[0][0] If $hWnd = $aListViewSortInfo[$x][1] Then $iIndex = $x ExitLoop EndIf Next $pFunction = DllCallbackGetPtr($aListViewSortInfo[$iIndex][2]) ; get pointer to call back $aListViewSortInfo[$iIndex][3] = $iCol ; $nColumn = column clicked If $nSortDir<>0 Then $aListViewSortInfo[$iIndex][5] = $nSortDir ; $nSortDir $aListViewSortInfo[$iIndex][4] = $aListViewSortInfo[$iIndex][6] ; nCurCol = $nCol $iRet = _SendMessage($hWnd, $LVM_SORTITEMS, $hWnd, $pFunction, 0, "hwnd", "ptr") If $iRet <> 0 Then If $aListViewSortInfo[$iIndex][9] Then ; Use arrow in header $hHeader = $aListViewSortInfo[$iIndex][10] For $x = 0 To _GUICtrlHeader_GetItemCount($hHeader) - 1 $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $x) If BitAND($iFormat, $HDF_SORTDOWN) Then _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTDOWN)) ElseIf BitAND($iFormat, $HDF_SORTUP) Then _GUICtrlHeader_SetItemFormat($hHeader, $x, BitXOR($iFormat, $HDF_SORTUP)) EndIf Next $iFormat = _GUICtrlHeader_GetItemFormat($hHeader, $iCol) If $aListViewSortInfo[$iIndex][5] = 1 Then ; ascending _GUICtrlHeader_SetItemFormat($hHeader, $iCol, BitOR($iFormat, $HDF_SORTUP)) Else ; descending _GUICtrlHeader_SetItemFormat($hHeader, $iCol, BitOR($iFormat, $HDF_SORTDOWN)) EndIf EndIf EndIf Return $iRet <> 0 EndFunc ;==>_GUICtrlListView_SortItems_NoToggle I added the variable "$nSortDir" to the function call which allows you to specify Asc/Desc (note: 1=Asc, -1=Desc, 0=Current). Regards, Timbo -
Hello All, Unfortunately I imagine I am asking the impossible, but I will make my attempt anyway. Overview: Basically I would like to sort the same column twice without affecting the Asc/Desc (i.e. If currently sorted in Asc order, then sort again in Asc order). e.g. if an item value has dynamically changed, and it needs to be sorted back into the correct sequence. Scenario: I have a listview which has items dynamically updated (via GUICtrlSetData Or _GUICtrlListView_SetItem, not important). When I have the listview sorted, and one of those items is updated, I need to trigger a sort again (to reposition the item in the correct order). This can easily be done by calling "_GUICtrlListView_SimpleSort" and toggling the "$B_DESCENDING" value (will result in the column being sorted using same Asc/Desc order as previously called). Problem: As many of you know "SimpleSort" sorts the values (via an array), then repopulates the listview in such a way that the values no longer relate to the original "controlID" that it was created with (via "GUICtrlCreateListViewItem"). On the other hand, "_GUICtrlListView_SortItems" manages to sort the values while maintaining the "controlID". This means that formatting (set via "GUICtrlSetBkColor" and "GUICtrlSetColor") stick to the intended values. Example: I only just figured all this out myself, so I thought I should provide some code to help others understand: #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() GUICreate("listview items", 220, 250, 100, 200, -1) Local $listview = GUICtrlCreateListView("Col 0|Col 1|Col 2", 10, 10, 200, 170) Local $B_DESCENDING[3] Local $listValues[10] For $i = 0 To UBound($listValues)-1 If $i = 2 Then $listValues[$i] = GUICtrlCreateListViewItem("Green|"&($i+1)&"|"&($i+1), $listview) Global $greenVal=($i+1) ElseIf $i = 6 Then $listValues[$i] = GUICtrlCreateListViewItem("Red|"&($i+1)&"|"&($i+1), $listview) ElseIf $i = 8 Then $listValues[$i] = GUICtrlCreateListViewItem("Blue|"&($i+1)&"|"&($i+1), $listview) Else $listValues[$i] = GUICtrlCreateListViewItem("White|"&($i+1)&"|"&($i+1), $listview) EndIf Next GUICtrlSetBkColor($listValues[2],0xD0FFD0) GUICtrlSetBkColor($listValues[6],0xFFD0D0) GUICtrlSetBkColor($listValues[8],0xCDDEFD) Local $button = GUICtrlCreateButton("Update green row and re-sort", 10, 185, 200, 20) Local $radio[2] $radio[0] = GUICtrlCreateRadio("Sort via SortItems", 5, 210, 200, 20) $radio[1] = GUICtrlCreateRadio("Sort via SimpleSort", 5, 230, 200, 20) GUICtrlSetState($radio[0], $GUI_CHECKED) GUISetState() _GUICtrlListView_RegisterSortCallBack($listview) Global $lastSortCol=2 _GUICtrlListView_SortItems($listview, $lastSortCol) ;Sort by Col 2 on open Do Local $msg = GUIGetMsg() Select Case $msg = $listview If BitAND(GUICtrlRead($radio[0]), $GUI_CHECKED) = $GUI_CHECKED Then $lastSortCol=GUICtrlGetState($listview) _GUICtrlListView_SortItems($listview, $lastSortCol) ElseIf BitAND(GUICtrlRead($radio[1]), $GUI_CHECKED) = $GUI_CHECKED Then $lastSortCol=GUICtrlGetState($listview) _GUICtrlListView_SimpleSort($listview, $B_DESCENDING, $lastSortCol) EndIf Case $msg = $button $greenVal=$greenVal*5 GUICtrlSetData($listValues[2], "|"&$greenVal&"|"&$greenVal) Sleep(2000) If BitAND(GUICtrlRead($radio[0]), $GUI_CHECKED) = $GUI_CHECKED Then _GUICtrlListView_SortItems($listview, $lastSortCol) ElseIf BitAND(GUICtrlRead($radio[1]), $GUI_CHECKED) = $GUI_CHECKED Then $B_DESCENDING = NOT $B_DESCENDING _GUICtrlListView_SimpleSort($listview, $B_DESCENDING, $lastSortCol) EndIf EndSelect Until $msg = $GUI_EVENT_CLOSE _GUICtrlListView_UnRegisterSortCallBack($listview) EndFunc ;==>Example Steps to recreate: 1) Load above automation - note that column 2 is already sorted in Asc order) 2) Click the "Update green row and re-sort" button - this will update the green row, sleep for 2000, then trigger a sort You should notice that col 2 was initially sorted in Asc order, then after the sort was triggered it toggled to Desc (I want it to sort again in Asc order). Obviously, toggling Asc/Desc is the intended purpose (i.e. clicking on headings), but I'm wondering if an exception can be triggered for situations like this? I have also built in the ability to switch between sort methods ("SortItems" and "SimpleSort") to display the issue with formatting and "controlIds". (Edit: Click the headings of the listview to see what I mean) Many thanks in advance, Timbo
-
Well then, a couple of votes for C#, not much regarding C++? So it seems C# is gaining a huge following (duh), and is obviously getting quite flexible (with its ongoing revisions). So is C++ losing it's relevance in the general application development arena? (Please don't flame me) I understand that many games and even operating systems are built on C++, and it's probably the go-to choice for corporations that wish to release software to the public (citation needed). But for the average company developing in-house software, would I be correct to assume they'd more often be developing on C# these days? The reason I ask is, one day, in the very distant future I will attempt to learn one (or both of the languages), talk is cheap I know. But since I was in school (many years ago), C++ was the language to learn. Here I am many years later, and it's obviously still heavily used, but I now have the option of the younger rival C#. All that said, I can't see myself ever working for a games company or Microsoft where I'd be hacking out code for a multi-million dollar project, more likely a small to medium business designing a custom CRM, or some sort of (no UI) back end data processing. So I'm wondering (without being too selfish), how will these two languages will help me? -Timbo
-
Hello all, I've often read posts where people ask "which is the best language" or "I want to learn a language, which is best". I more often than not read these posts as I (used to) wonder this myself. As many of you would know, the replies are often the same - "Depends what you want to do", sound advice... I only have experience with scripting languages (AutoIt isn't encouraging me to develop in anything else), so I have very little understanding of the benefits to using either language (C++ or C#), so my interest was tweaked when I read a job advert for a Software Engineer position (which I am grossly under-qualified for). The job advert specified they would like a person with deep technical knowledge in C++ & C#. It also went on to say that the company used C++ for their data processing (i.e. number crunching), and C# for their UI (i.e. client/user facing apps). This seems to follow the trend of people saying C and C++ are "fast" (relative term I know) languages, and C# makes programming GUI's easier? I don't know if the aforementioned benefits are correct, so this brings me to my question (sorry it took so long): Q1. Does this sound like "good practice" (if you can pull it off), or is it purely seeking perfection in a competitive corporate environment? I've written a few scenarios down below to see if I've grasped what the company looking for a Software Engineer would be interested in accomplishing. The following scenarios are no doubt highly dependant on the programmer's ability, so let's assume the programmer (in this case, me) would be proficient in the specified language (C++ or C#): If I wanted to build a program to process data quickly and efficiently, without the need for a UI (probably on a server somewhere), I imagine the best language would be: C++If I wanted to build a program to retrieve the aforementioned processed data (i.e. the result) probably via SQL, and display it in a friendly UI for the client/user, I imagine the best language would be: C#Seems pretty straight forward so far... What if I wanted to build a program in which the client/user had to enter a large amount of data (of which the program would then need to quickly and efficiently process), and then return the result to the user?Well... I imagine if you were proficient in both C++ & C# you could create a UI in C# and pass the data off to a C++ module (correct term?) for processing, if you were proficient in one more than the other, then I imagine you write the whole thing in that language. Now my final question/s: Q2. In your personal (experienced programmers) opinion, would you use this method if you were proficient in both languages? If not, why? Thanks in advance for any input. I hope that I have grasped enough of the basic concepts of lower level programming to portray my questions in a legible fashion. -Timbo
-
Well, I did post this in a support forum... Thanks for your advice b3lorixx! I tried: Local $item=ObjGet("C:\Neighbours Backyard\Under Tree\Sleeping Cat.exe") And that seems to be working now, thanks! Ref: http://en.wikipedia.org/wiki/User:MartinHarper/cat_skinning Though I’ve made another script to compensate for my poor sense of humor: Local $item=ObjGet("C:\My Desk\My Chair\Me.exe") If $item.Funny==False Then While $item.Funny==False $item.Action("BangHeadOnDesk") If $item.Status="Unconscious" Then ExitLoop WEnd EndIf
-
Can anyone help me skin this cat? I've tried many ways (I've listetd three below), but I just can't seem to get it to work. It seems to be failing on line 1, my attempt to 'get' the cat? I'd be very interested in other peoples attempts at this, as I'm sure I can't be the first that's tried it... ;Exapmle 1 Local $item=ObjGet("cat") skin($item) If skinned($item)==True Then MsgBox (64, $item.Name&" has been skinned!", "Congratulations, your '"&$item.Name&"' has been skinned.") EndIf ;Exapmle 2 Local $item=ObjGet("cat") Do skin($item) Until skinned($item)==True MsgBox (64, $item.Name&" has been skinned!", "Congratulations, your '"&$item.Name&"' has been skinned.") ;Exapmle 3 Local $item=ObjGet("cat") While skinned($item)==False skin($item) WEnd MsgBox (64, $item.Name&" has been skinned!", "Congratulations, your '"&$item.Name&"' has been skinned.") ;Functions Func skin($item) If $item.Type="feline" AND $item.Pelt==True Then $item.Action("skin") EndIf EndFunc Func skinned($item) If $item.BloodyMess==True Then Return True Else Return False EndIf EndFunc Thanks in advance! -Timbo
-
Hi, Try PDFTK (PDF Toolkit): http://www.accesspdf.com/pdftk/ I've only used it to join PDF's together with AutoIt, but I've noticed that it can fill out PDF forms via command line. Oh, the best thing is that it's free! I presume you'll need to use "ShellExecute()" in your AutoIt script to utilise this little utility. Best of luck! -Timbo
-
Why can't AutoIt perform basic maths?
timbo replied to timbo's topic in AutoIt General Help and Support
Well thanks to Manadar & bo8ster, the only two with an actual answer to my question. I am yet to be proven stupid (Valik pending) with an example of what I should have searched for, and I'm unimpressed with Volly's contribution especially as it seems he didn't even read my initial post stating that I had attempted searching for the solution. As you may have noticed I am new to this community, and I am yet to find my place in it. I always do my best to read help files, guides and to search the forums, but regardless of this it seems I have still managed to upset some people. (I think I may have brought it on myself with the "Basic Maths" quip... ) Again, many thanks! -Timbo -
Why can't AutoIt perform basic maths?
timbo replied to timbo's topic in AutoIt General Help and Support
Ah, I see. My apologies to the AutoIt team; it seems they are bound by the laws of Binary Number Systems. So am I right to presume this would happen in other programming languages? Anyway, I'll program around it by splitting that values either side of the floating point into integers. @Volly: Are you insinuating that I'm stupid? I have began searching like mad to find a similar post (as I feel silly now for wasting everyones time), but I still cannot find anything related. My search skills must need some significant improvement. I did say in my original post that I did attempt to search, but my attempts didn't yield any results. -
Why can't AutoIt perform basic maths?
timbo replied to timbo's topic in AutoIt General Help and Support
Maybe Valik can suggest what search string I could use exactly? -
Hello Everyone, Sorry for the topic title; I figured it would get a little more attention if I put it that way. I love AutoIt; but still, this is a problem with basic maths. I sure I'm not the first person to experience this so I have tried searching for the solution, but I don't know the best keywords to use? "+float +addition +loop"...? Anyway, I have the most basic loop (using a float instead of and integer for the loop increment), but it keeps producing incorrect values. See code below: CODELocal $temp_file=FileOpen(@ScriptDir & "\test.txt", 10) For $x = 0.001 to 1.50 Step 0.001 FileWrite($temp_file, $x & " " & 0.001 & @CRLF) Next FileClose($temp_file) Now it's pretty easy to imagine what the above would output, but for some reason it occasionally throws the float value out by a 0.0000000000000001 (+ or -). See output below: 0.068 0.001 0.069 0.001 0.07 0.001 0.071 0.001 0.0720000000000001 0.001 0.0730000000000001 0.001 0.0740000000000001 0.001 0.0750000000000001 0.001 0.0760000000000001 0.001 0.0770000000000001 0.001 0.0780000000000001 0.001 0.0790000000000001 0.001 0.0800000000000001 0.001 0.0810000000000001 0.001 0.0820000000000001 0.001 0.0830000000000001 0.001 0.0840000000000001 0.001 0.0850000000000001 0.001 0.0860000000000001 0.001 0.0870000000000001 0.001 0.0880000000000001 0.001 0.0890000000000001 0.001 0.0900000000000001 0.001 0.0910000000000001 0.001 0.0920000000000001 0.001 0.0930000000000001 0.001 0.0940000000000001 0.001 0.0950000000000001 0.001 0.0960000000000001 0.001 0.0970000000000001 0.001 0.0980000000000001 0.001 0.0990000000000001 0.001 0.1 0.001 0.105 0.005 0.11 0.005 0.115 0.005 Now this could be corrected by using "Round()", but I need to round to both 3 decimal places and 2 decimal places (dependant on the situation). Anyway, even if this was an option, I'd still like to know why this isn't calculating properly. Thanks in advance for any assistance provided. -Timbo
-
I have all you're problems sorted! With Window Server you can have multiple "Terminal Service" sessions: Go to a workstation, and open a Remote Desktop Connection Window: Start --> All Programs --> Accessories --> Communications --> Remote Desktop Connection (If the above fails, try: Start --> Run --> type "mstsc.exe" (press enter)) In the "Computer" field type the server name or IP address followed by a space and "/console", then press enter. E.g. "servername /console" (without the quotes) Login as per usual. You will now notice that you are logged into the server yet it is still locked! (when physically at the terminal) This is more a visual demonstration to show you that the server can be logged in even if you can't see it. --------------------------------------------- Really all you need to do is Schedule your automation via: Start --> Control Panel --> Scheduled Tasks --> Add Scheduled Task Schedule the task to run and make sure you add the Administrator password in the appropriate area under the "Task" tab. You will notice that if you login as with the "/console" switch you can see the task (your automation) running. Hope this helps! Oh, and this only works on Windows Server not Windows XP. XP can only handle one session at a time.
-
Creating SQLite User Defined Function
timbo replied to timbo's topic in AutoIt General Help and Support
I see... Yeah, I probably should have said Stored Procedure but I thought SQLite called them User Defined Functions; apparently not. Thanks for finding that though; I dug through soo many pages looking for an explanation but I guess your Googling skills are superior to mine. Also, I think SQLite's reasoning is spot on, what I was trying to do with SQLite was much better suited to an SQL Server (MS SQL in this instance). Many Thanks! -Timbo -
Creating SQLite User Defined Function
timbo replied to timbo's topic in AutoIt General Help and Support
Thanks for the reply PsaltyDS, but that's not the UDF I was looking for. Sorry it's taken me so long to reply. I got sick and the problem was null and void by the time I got back to work (and as a result, I completely forgot about my post). Anyway, when programming in SQL you can usually create UDF's in the SQL server which will run during an SQL query. I was thinking if I could build a particular function into the SQLite (server instance), then it may be able to execute the function quicker than executing an SQL query, getting the results, performing the calculation, then building another SQL query based on the results. Best practice would be to build an SQL function to perform all that in one query. I would still be interested in an answer, but it is no longer a pressing matter. -Timbo -
Hello All, I've recently discovered the extremely useful SQLite functionality in AutoIt, but I'm now stumped when trying to create a User Defined Function in SQLite. You may say I could create an AutoIt function which makes SQL queries and manipulates the data as needed, but I think a native SQL function would be significantly quicker. I have looked through the AutoIt manual and the SQLite manual bundled with the AutoIt install, but I cannot find anything referring to creating a user defined function? I'm I missing something, or is this feature not a necessity? Many Thanks! -Timbo
-
Not closing/terminating objects; can it slow my PC down?
timbo replied to timbo's topic in AutoIt General Help and Support
I don't mind. It's not impacting me greatly, it obviously isn't a common problem, and it may not even be directly related to AutoIt. Though, if you think it may add some value to get a few people looking into it then go ahead, but I'm happy to let this one fade away. -
Hello All, My first post, so I hope I'm not being ignorant. I've noticed as of late that the "rundll32.exe" process is chewing up more and more of my processor usage, and it's only since I've been using ObjCreate() in my development more often. If I restart my PC everything returns to normal so it's not a big problem, but I may want to start running my scripts on a server (which I cannot restart as often). Often during development I may exit a running script via right clicking the icon in the taskbar and clicking "Exit". So I'm thinking that when I do this, the Object that my AutoIt script has created is not being terminated. I think that all the objects I usually create open with their own process, which I can subsequently kill via the task manager or simply by closing the application (if one was spawned/visible). As you may have gathered; I don't know a great deal about the "rundll32.exe" process, so my question is: Is the "rundll32.exe" process it related to the ObjCreate() function in any way, or could this be more object specific (i.e. the objects I am creating interact with the "rundll32.exe" process and are not terminating properly).