Leaderboard
Popular Content
Showing content with the highest reputation on 02/25/2015 in all areas
-
That's why it's called FileSelectFolder() Try the FileOpenDialog(), that might just be what you need.2 points
-
Func _myCustomFunc($vVal) Local Const $sBin = "(?i)^0x[a-z\d]+$" If IsInt($vVal) Or StringIsInt($vVal) StringIsFloat($vVal) Then Return "Number" EndIf Local $iLen = StringLen($vVal) Local $sType = VarGetType($vVal) If $sType = "Binary" Or ($iLen > 2 And Mod($iLen, 2) = 0 And _ StringRegExp($vVal, $sBin)) Then Return "Binary" EndIf Return $sType EndFunc Edit: Hate editing in this thing1 point
-
You could always roll your own, but as brew said above, your hex "0xAB" will be considered a binary string in this code, not an integer Func _myCustomFunc($vVal) Local Const $sBin = "(?i)^0x[a-z\d]+$" Local $iLen = StringLen($vVal) Local $sType = VarGetType($vVal) If $sType = "Binary" Then Return "Binary" If $iLen > 2 And Mod($iLen, 2) = 0 And _ StringRegExp($vVal, $sBin) Then Return "Binary" If StringIsInt($vVal) Then If Abs($vVal) <= 2147483647 Then Return "Int32" Return "Int64" EndIf If StringIsFloat($vVal) Then Return "Number" Return $sType EndFunc .1 point
-
Be aware though that nothing will be identified as a Binary number unless you send it to the function using Binary on the number first. Also remember, that a hexidecimal number is just a base 16 number representation of a base 10 number. So if you send it a hex number, it's going to be translated to an integer, and using Hex on it will convert it to a string. $sString = "String" ConsoleWrite(IsWhat($sString) & @CRLF) $iInteger = 2 ConsoleWrite(IsWhat($iInteger) & @CRLF) $nDouble = 1.234 ConsoleWrite(IsWhat($nDouble) & @CRLF) $nBinary = 0x556 ConsoleWrite(IsWhat($nBinary) & @CRLF) ConsoleWrite(IsWhat(Binary($nBinary)) & @CRLF) ConsoleWrite(IsWhat(Hex($nBinary)) & @CRLF) Func IsWhat($IsWhat) Return VarGetType($IsWhat) EndFunc1 point
-
no, "1.234" is a string 1.234 is a Float try with StringIsFloat maybe? note that you can open help file on StringIsFloat and try the example on that help file page, do a index type for StringIs and look @ variety of commands edit: reading from all of your topics i think you only need to check for 2 things StringIsFloat ? StringIsInt ?1 point
-
That function only deals with numbers, the minus sign isn't a number so the string isn't seen as a number. It would be the same result if you used "1.0", as the decimal point isn't a number. Not a bug.1 point
-
Not for this - the "Use Windows XP style DPI scaling" is not a compatibility mode, it's actually what this thread is all about. On Win7 when you select a custom DPI (emphasis on custom) and in Win8 as well (though in a slightly different place) the options window has an extra checkbox which is what controls the system-wide DWM scaling (sometimes called "DPI Virtualisation") that was introduced in Vista+. Basically it's what this manifest setting actually does: declaring an application DPI "aware" means that the application itself is 100% responsible for any scaling (as it was in XP). Normally (as above) if the user selects a DPI of 150 Windows automatically enables DPI Virtualisation (i.e., it's the same as forcing the Use Windows XP style box to be unchecked). This is what causes the blurriness that people don't like. On the other hand, it does conveniently scale all elements of a (non-aware) GUI in a nice clean way - no worrying about either calculating the expansion of individual controls, or reducing the font size or however one cares to handle it. At the end of the day, it's the same as the API's SetProcessDPIAware function, though AutoIt binaries have a tendency to resist that function's affections for some reason. Above, when I found that the DPI ratio was incorrectly being reported as 1 (instead of 1.5) that's the DPI Virtualisation getting in the way - when DPI awareness is set (by whatever method), the ratio will always return 1.5, regardless of what setting the user selected. The downside of this is that it is indeed not a magic bullet for scaling, and the developer has to do everything himself. Another downside is that some versions of obtaining the DPI setting will fail on these compiled EXE's because for some unknown reason the GDI+ method of reading the ratio fails when Awareness is set - but there are other methods available, like the one I used above (stolen and simplified from Phillip123Adams approach, found in an old post of his which has since slipped into the aether). Adding DPI-awareness to the wrapper is a good thing, if for no other reason than the user's programme will always behave predictably (and report the proper DPI) no matter what options in Windows were set or unset (beyond the dev's purview). And by "predictably" I mean that it will always have an ugly/skewed GUI because DPI Virtualisation can never be applied to it, thus requiring the dev to either shrink the font size (boo hiss!) or handle the control scaling on an individual basis himself. That part's up to us. All that being said, for those who don't mind letting Windows handle things, all they have to do is ignore this wrapper setting and tell their complaining users to uncheck the Use Windows XP style DPI scaling box like they've always done, and learn to live with the blur. Final verdict (at least by me): #AutoIt3Wrapper_Res_HiDpi=Y does work, and it's good thing, but it just doesn't work the way we hoped it would. There just is no magic bullet, and no substitute for hard work.1 point
-
Try Disabling Spy++ Control Detection Logic [Ctrl + Alt + S to toggle]1 point
-
Example #include <Excel.au3> Global $aStart = [["Row1", "Col1"], ["Row2", "Col1"], ["Row3", "Col1"]] Global $aAppend = [["Append1", "Col1"], ["Append2", "Col1"], ["Append3", "Col1"]] Global $oExcel = _Excel_Open() Global $oWorkBook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkBook, Default, $aStart, "A1") Global $iLastUsedRow = $oWorkBook.ActiveSheet.UsedRange.Rows.Count _Excel_RangeWrite($oWorkBook, Default, $aAppend, "A" & $iLastUsedRow + 1)1 point
-
As draien said inserting rows after the last used row doesn't make sense. As I said in post #7 use _Excel_RangeWrite.1 point
-
Isnt it doing what its supposed to? You insert from 2000:2002 (3 rows), it is what your picture shows. What do you expect it to do?1 point
-
Excel Inserting Row(s)
santhoshkumargr reacted to draien for a topic
Okay now I am confused. $rowcount += 1 ; want to add rows below that You want to add empty rows after the last row used? Why? I mean this doesn't change a thing at all, because the rows after the last used row, are already empty.1 point -
Excel Inserting Row(s)
santhoshkumargr reacted to water for a topic
OK, I think I need to enhance documentation how _Excel_RangeInsert works. Then the bugs in the example scripts need to removed. @JohnOne If you want to add data to the end of the worksheet use $oWorkbook.ActiveSheet.UsedRange.Rows.Count add 1 and you have the row where you can write data using _Excel_RangeWrite. This is true as long as the usedrange starts in row 1. For details and examples please check the wiki.1 point -
I made a nice Script that i am lunching with autoit. it disable UAC but you wont be able to run it without typing manualy your credential if that interesting yourself you can message me i will pm you how to do.1 point
-
Hi As santhoshkumargr stated, the "2:2" is specified as a ExcelRange So for your goal to insert rows at the end of sheet, you have to get where the sheet actually ends. Therefore you can use something like this: Local $aResult = _Excel_RangeRead($oWorkbook, Default,$oWorkbook.ActiveSheet.Usedrange.Columns("A:A")) $iCells = UBound($aResult)-1 MsgBox(0,"UsedRange in Column A",$iCells) So you know where your sheet actually ends and then you can insert rows with something like that: $iRows = 3 ;Number of Rows to Insert _Excel_RangeInsert($oWorkbook.ActiveSheet, $iCells & ":" & $iCells+$iRows) 1 point
-
Excel Inserting Row(s)
SkysLastChance reacted to santhoshkumargr for a topic
Hello John, I tried to execute the script you shared. The problem is in this line _Excel_RangeInsert($oWorkbook.ActiveSheet, "2:2") ; "Before row, number of rows to insert " In the above line 2:2 indicates, adding of rows from 2nd row to 2nd row. That is the reason it inserts only one row. If you want to add two rows this is how it should be _Excel_RangeInsert($oWorkbook.ActiveSheet, "2:3") ; "Before row, number of rows to insert " Good luck1 point -
i once encountered an incident where the ini file was generated by a Unix system - in some bizarre format - and Windows API of the ini* function was unable to parse. i dug a bit and found the file - it is attached. extract it, open it in Notepad and see for yourself, then open it in NotePad++ to see how it really is: White_to_Include_bad.zip (Note: it is zipped because when i tried to upload it as is to the forum, it says i'm not allowed to upload this kind of file. it is safe, though.) luckily, at the time i was developing my >LFN UDF, with its own set of functions to handle ini files without relying on the Windows API. i just applied it, and it worked right-off. here is an adapted version of the LFN function to read a value from ini file. test it on your original file (if you still have a copy of it): Func _IniRead($sFile, $sSection, $sKey, $xDefaultValue) ; adapated from the LFN UDF If Not FileExists($sFile) Then Return $xDefaultValue Local $aFileLines = FileReadToArray($sFile) If @error Then Return $xDefaultValue Local $bSectionFound = False Local $iPos = 0 For $i = 0 To UBound($aFileLines) - 1 If StringLeft($aFileLines[$i], 1) = '[' Then If StringLeft($aFileLines[$i], StringLen($sSection) + 2) = '[' & $sSection & ']' Then $bSectionFound = True Else If $bSectionFound Then ; entering next section, key not found Return $xDefaultValue ExitLoop EndIf EndIf Else If $bSectionFound Then $iPos = StringInStr($aFileLines[$i], '=') If $iPos = 0 Then ContinueLoop If StringLeft($aFileLines[$i], $iPos - 1) = $sKey Then Return StringTrimLeft($aFileLines[$i], $iPos) EndIf EndIf Next Return $xDefaultValue EndFunc ;==>_IniRead1 point
-
Your code is going to bleed memory, you never close the FileOpen call. Func IniWriteData() If Not FileExists($sFileINI) Then FileClose(FileOpen($sFileINI,2+8)); 2 creates a new file, not 1 IniWrite($sFileINI, "Lab Description", "Description", "Value Description" ) IniWrite($sFileINI, "OVF Instructions", "OVFDeploy", "Value OVFDeploy" ) ;~ Return FileExists($sFileINI) Return ((IniRead($sFileINI, "Lab Description", "Description", "Error")<>"Error") And (IniRead($sFileINI, "OVF Instructions", "OVFDeploy", "Error")<>"Error")) EndFunc .1 point
-
Kids PC help
HiNoTora reacted to jaberwacky for a topic
This should do it: Global $iexplore_pid Do $iexplore_pid = ProcessExists("iexplore.exe") If $iexplore_pid <> 0 Then ProcessClose($iexplore_pid) MsgBox($MB_OK, "INTERNET", "INTERNET ON PLOKEERITUD. VÕTA ÜHENDUST OMA ARVUTI HALDAJAGA", 20) EndIf Sleep(1000) Until False1 point -
How about something like this? #include <FileConstants.au3> #include <StringConstants.au3> $batchfiles = FileOpenDialog("test", "c:\tmp", "Batch files (*.bat)", $FD_MULTISELECT) If @error Then MsgBox(16, "Failed", "File selection failed, error: " & @error) Exit EndIf ConsoleWrite("Chosen batchfiles: " & $batchfiles & @CRLF) If StringInStr($batchfiles, "|") Then ; contains a pipe, means multiple batchfiles were selected $chosenArray = StringSplit($batchfiles, "|") ; Say we have "c:\tmp|x.bat|y.bat", the array elements after split will be: ; [0]: 3 ; [1]: "c:\tmp" ; [2]: "x.bat" ; [3]: "y.bat" $folder = $chosenArray[1] for $i = 2 to $chosenArray[0] $file = $chosenArray[$i] $filepath = $folder & "\" & $file ConsoleWrite("Doing magic on file: " & $filepath & @CRLF) Next Else ConsoleWrite("Doing magic on file: " & $batchfiles & @CRLF) EndIf1 point
-
So, let me get this straight: 1) You suck so much at the game that you decide to cheat. 2) You now try to start sucking at coding. Mfw Lmao, gr8 b8 m8 i r8 it 8/8 no h8.1 point
-
Welcome to AutoIt and the forum! Do you think it is sensible to post in a thread where the last post is 3 years old and the OP has been offline for nearly 2 years1 point
-
here an "unnerving" variant it will disturb you till you will click OK _MsgBox() Func _MsgBox($msg = "Pause", $title = StringMid(@ScriptName, StringInStr(@ScriptName, "\", 0, -1) + 1), $flag = 0, $out = 0) Do $out = MsgBox($flag, $title, $msg, 2) Until 1 = $out Return $out EndFunc ;==>_MsgBox1 point
-
you cant just whip out -4152 in front of muggles.1 point
-
Hi jorgev! You are right. At this Moment it is not possible to insert an handle to an tabitem. (Only for the tab) But i will add this in the next update. (So you can make an right click on the tabitem and set the handle)1 point
-
.Net programs can be problematic, and these type of guessing threads are many. Since this is a secret app, the onus is on you to try code, and post it along with the results. First off "Step 3 :I don't know how to focus to the A controller and send the ID message" Look at ControlSetText in help file and try it.1 point
-
In general case the forum do not giving a lot of help without a view of your program Can you provide us screenshot or more info ? You can also check in the helpfile in the index : "control" and you will learn how to work with controls1 point
-
BTW, packH looks nothing more than: Func _packH($sInput) Return ((StringLeft($sInput, 2) = "0x") ? _ BinaryToString($sInput):BinaryToString("0x" & $sInput)) EndFunc To me... or am I missing something?1 point
-
chibill, It is nice to see that you are learning AutoIt, but please do not post any more scripts taken directly from the Help file. But do post any scripts you have coded yourself in this thread - we encourage members to show off their own work. M231 point
-
What guinness pointed out here is true and IMO very bad. I see that as being just the same as copying anybody elses code around here and then trying to pawn it off as if you wrote it. Even if its modified, you should still credit where you got your original code from.1 point
-
It's good you're starting small and posting examples for those who might want to learn too, but the following have just been lifted directly from the Help file 'list drives.au3', 'IP get.au3' & 'autoit update.au3'.1 point