Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/17/2014 in all areas

  1. Gianni

    Problem with StdoutRead

    what do you get with this #pragma compile(Console, true) Local $hPID = Run("PowerCFG -L", @SystemDir, @SW_HIDE, 0x2), $output = "" Do $output &= StdoutRead($hPID) Until @error ConsoleWrite($output)
    1 point
  2. Here you are: #include <Array.au3> #include <SQLite.au3> #include <SQLite.dll.au3> _SQLite_Startup() Local $hDB = _SQLite_Open(@ScriptDir & "\softwareset.db3") _SQLite_Exec($hDB, "create table if not exists Software (id integer primary key, Name char collate nocase, Version char, Company char collate nocase)") Local $input = FileRead(@ScriptDir & "\software.txt") Local $entries = StringRegExp($input, "(?ims)^Entry Name[\s:]+(\N*?)\R.*?^Version[\s:]+(\N*?)\R.*?^Company[\s:]+(\N*?)\R", 3) _ArrayDisplay($entries) If @error Then MsgBox(0, "", "No entry found; check input.") Else _SQLite_Exec($hDB, "begin;") For $i = 0 To UBound($entries) / 3 - 1 _SQLite_Exec($hDB, "insert into software (" & _ "name, " & _ "version, " & _ "company " & _ ") values (" & _ _SQLite_FastEscape($entries[3 * $i]) & ", " & _ _SQLite_FastEscape($entries[3 * $i + 1]) & ", " & _ _SQLite_FastEscape($entries[3 * $i + 2]) & _ ");") Next _SQLite_Exec($hDB, "commit;") EndIf ; what do we have so far? Local $aRows, $iRows, $iCols _SQLite_GetTable2d($hDB, "select * from software order by company, name, version;", $aRows, $iRows, $iCols) _ArrayDisplay($aRows) _SQLite_Close($hDB) _SQLite_Shutdown() You can use the free version of SQLite Expert to play with any SQLite database.
    1 point
  3. anhyeuem, You need to give the marquee time to display by sending the letters separately: #include <ProgressConstants.au3> #include <GuiConstantsEx.au3> #include <SendMessage.au3> Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy" Global $iTextLen = StringLen($sText) $Form1 = GUICreate("test", 619, 250, -1, -1) $Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153) $Button = GUICtrlCreateButton("Run", 310, 176, 290, 33) $Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33) $progressbar = GUICtrlCreateProgress(100, 176, 200, 33, $PBS_MARQUEE) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button a() Case $Button1 about() EndSwitch WEnd Func a() GUICtrlSendMsg($progressbar, $PBM_SETMARQUEE, True, 50) ; Marquee on Run("Notepad") WinWaitActive("Untitled - Notepad") ; Now send 1 letter at a time For $i = 1 To $iTextLen ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1)) Sleep(10) Next GUICtrlSendMsg($progressbar, $PBM_SETMARQUEE, False, 50) ; Marquee off EndFunc ;==>a Func about() EndFunc ;==>about And that is all the homework help you get from me today - try and solve the next problem yourself. M23
    1 point
  4. anhyeuem, Search the forum for "marquee progress" - there are lots of examples. M23
    1 point
  5. Sundance

    ShadowCopy creation

    So master Lars. IT IS DONE! :-) After reading a nice sheet from MS which additional commands we need it now functions. The added script will take a shadow copy snapshot of drive C: and D: (under a 32Bit >=Vista operating system) I'am very thankfull of your valuable help Lars!!! Without you I hadn't no chance of doing this. Now we can do shadowcopies directly with AutoIt. Thanks! Sundance COMshadow.au3
    1 point
  6. anhyeuem, As far as I can see you cannot reliably determine the time it will take to send the various letters to Notepad, so you cannot use a timer. I suggest something along these lines: #include <GuiConstantsEx.au3> #include <ProgressConstants.au3> Global $sText = "fdsfdsfdsdgfdddddddddddddddddrrrrrrrrrrrrrryyyyyyyyyyyyyhhhhhhhhhhhhhhhhhd?gdfgfdgdfgdfgregdfgdfgffffffffffffffaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttttyyyyyyyyyyyyyyyyyy" Global $iTextLen = StringLen($sText) $Form1 = GUICreate("test", 619, 250, -1, -1) $Edit1 = GUICtrlCreateEdit("", 8, 8, 601, 153) $Button = GUICtrlCreateButton("Run", 310, 176, 290, 33) $Button1 = GUICtrlCreateButton("About", 20, 176, 70, 33) $progressbar = GUICtrlCreateProgress(100, 176, 200, 33) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button a() Case $Button1 about() EndSwitch WEnd Func a() Run("Notepad") ; Move progress 10% while Notepad loads GUICtrlSetData($progressbar, 10) WinWaitActive("Untitled - Notepad") ; Now send 1 letter at a time For $i = 1 To $iTextLen ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", StringMid($sText, $i, 1)) ; And advance progress a little for each letter sent Sleep(50) GUICtrlSetData($progressbar, 10 + 90 * ($i / 90)) Next EndFunc ;==>a Func about() EndFunc ;==>about M23
    1 point
  7. anhyeuem, Yes, yes, yes. Those other threads are only tenously connected - and you have already asked the question in this one. As I said above, please stick to just the one thread at a time. M23
    1 point
  8. anhyeuem, Please stop hijacking other threads by posting this question in them - stick to this one. M23
    1 point
  9. @stenioc1 did you try this: $oIE_Graphic = _IEGetObjByName($oIE, 'MapdbbTopGraphic:_ct10:ccTopGraphic') _IEAction($oIE_Graphic,'click')
    1 point
  10. @TechCoder, im no expert, but it seems like you should pass pointers to strings to those functions, I fiddled around mainly since you bothered to to put up a testing page and this seems to work : #include <libcURL.au3> Global $bMyData = Binary("") _Demo1() Func _Demo1() Local $user = "AutoItuser" Local $pass = "AutoItuser" Local $testit = InputBox("SELECT", "Enter 1 for 'CURLOPT_POST as in php'" & @CRLF & "2 for 'CUSTOMREQUEST as works in php'" & @CRLF & "or anything else for 'best AutoIt so far'", 1) Local $sURL = "http://cashflowproducts.com/test/Booked/Web/Services/Authentication/Authenticate" Local $body = '{"username":"' & $user & '","password":"' & $pass & '"}' Local $header_type = "POST" Local $hcurl = _curl_easy_init() ConsoleWrite("body is " & $body & @CRLF) If($hcurl) Then ; setup the URL Local $tCURLSTRUCT_URL = DllStructCreate("char[" & StringLen($sURL) + 1 & "]") DllStructSetData($tCURLSTRUCT_URL, 1, $sURL) _curl_easy_setopt($hcurl, $CURLOPT_URL, DllStructGetPtr($tCURLSTRUCT_URL)) ; set up for output of callback Local $handle = DllCallbackRegister("_my_vwrite", "uint:cdecl", "ptr;uint;uint;ptr") _curl_easy_setopt($hcurl, $CURLOPT_WRITEFUNCTION, DllCallbackGetPtr($handle)) Local $tbody = DllStructCreate("char[" & StringLen($body) + 1 & "]") DllStructSetData($tbody, 1, $body) Local $theader_type= DllStructCreate("char[" & StringLen($header_type) + 1 & "]") DllStructSetData($theader_type, 1, $header_type) _curl_easy_setopt($hcurl, $CURLOPT_VERBOSE, 1) If $testit = 1 Then ; STANDARD POST _curl_easy_setopt($hcurl, $CURLOPT_POST, True); _curl_easy_setopt($hcurl, $CURLOPT_COPYPOSTFIELDS, DllStructGetPtr($tbody)); ElseIf $testit = 2 Then ; using _curl_easy_setopt($hcurl, $CURLOPT_CUSTOMREQUEST, DllStructGetPtr($theader_type)); _curl_easy_setopt($hcurl, $CURLOPT_COPYPOSTFIELDS, DllStructGetPtr($tbody)); Else _curl_easy_setopt($hcurl, $CURLOPT_HTTPPOST, $body); EndIf Local $iRes = _curl_easy_perform($hcurl) If $iRes > $CURLE_OK Then ConsoleWrite("!CURL; " & _curl_easy_strerror($iRes) & @CRLF) ElseIf $iRes = $CURLE_OK Then ConsoleWrite("+>CURL; Success!" & @CRLF) Local $sContentType $iRes = _curl_easy_getinfo($hcurl, $CURLINFO_CONTENT_TYPE, $sContentType); If $iRes = $CURLE_OK Then ConsoleWrite("+>CURL; We received Content-Type: " & $sContentType & @CRLF); $reply = BinaryToString($bMyData) ConsoleWrite(@ScriptLineNumber & " " & " this is the reply we got =>>" & @CRLF & $reply & @CRLF & "<<=" & @CRLF) EndIf EndIf _curl_easy_cleanup($hcurl) EndIf EndFunc ;==>_Demo1 Func _my_vwrite($buffer, $size, $nmemb, $stream) Local $vData = DllStructCreate("byte[" & $size * $nmemb & "]", $buffer) $bMyData &= DllStructGetData($vData, 1) Return $size * $nmemb EndFunc ;==>_my_vwrite
    1 point
  11. Not sure if this is what you want. #include <Array.au3> $removecommand = "1 2 8 8 11 27 99 06 041 245 875 88 8 7 45 99 076 789 654 108a" ;This is Userinput and they are freeish to enter the string as they wish, but they Normally don't enter above 999 $removecommand = StringRegExpReplace($removecommand, "\x20+", ",") $arrayRemovecommand = StringSplit($removecommand, ",") _ArrayDisplay($arrayRemovecommand) For $z = 1 To UBound($arrayRemovecommand) - 1 $arrayRemovecommand[$z] = DescFromCharacterToInt($arrayRemovecommand[$z]) Next _ArraySort($arrayRemovecommand, 0, 1) _ArrayDisplay($arrayRemovecommand) Func DescFromCharacterToInt($dfcti) Return stringformat("%03d",$dfcti) EndFunc ;==>DescFromCharacterToInt
    1 point
  12. AutoIt is just in between the cathedral and the bazaar. Take or leave.
    1 point
  13. rindeal, I think this sums you up quite nicely - especially after our PM exchange earlier today. M23
    1 point
  14. #include <GuiEdit.au3> #include <GUIConstantsEx.au3> GUICreate("test", 200, 300) $hEdit = GUICtrlCreateEdit("", 2, 2, 194, 268) GUISetState() _GUICtrlEdit_SetLimitText($hEdit, 10^9) $txt = "" For $i = 1 to 100000 $txt &= $i & " - test" & @crlf Next GuiCtrlSetData($hEdit, $txt) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE
    1 point
  15. Do you want to limit the number of word written in an Edit control OR do you want to write more then 30.014 words? http://msdn.microsoft.com/en-us/library/ms997530.aspx Global Const $EM_SETLIMITTEXT = 0x00C5 Global Const $hEditBufSize = 500000000 ;etc. $hEdit = GuiCtrlCreateEdit("", 100, 100, 250, 250) GUICtrlSendMsg($hEdit, $EM_SETLIMITTEXT, $hEditBufSize, 0)
    1 point
  16. Did you check documentation? I mean HelpFile, just press F1 in SciTe. There is very good example: You can even just click on GUICtrlCreateEdit() in your example from post #1, and then in "Related" you will see link to this function: GUICtrlSetLimit()
    1 point
  17. I had the same problem. I ended up just hidding the keyboard for a moment then sending the key.. Being that its in WinPE(not many resources running).... you never saw the keyboard disappearing.
    1 point
  18. UDFs shouldn't use MsgBox() to report errors, this is down to the developer to decide. You have quite a bit of work to do before calling this a UDF.
    1 point
  19. Another fine adjustment needed. When the test data has a trailing linefeed as in mLipok's example of post #11, another additional linefeed is added. So "|z"is added to the RE pattern to stop the additional trailing linefeed being added to the output. Local $txt = '' $txt &= "TEST1" & @TAB & "2013-02-08" & @TAB & "some text" & @CRLF ; HERE I want to add new line $txt &= "TEST 2" & @TAB & "2013-2-08" & @TAB & "some text" & @CRLF $txt &= "TEST 2" & @TAB & "2013-01-15" & @TAB & "some text" & @CRLF $txt &= "TEST 2" & @TAB & "2013-01-15" & @TAB & "some text" & @CRLF $txt &= "TEST 2" & @TAB & "2013-01-03" & @TAB & "some text" & @LF ; HERE I want to add new line $txt &= "TEST3" & @TAB & "2013-1-17" & @TAB & "some text" & @LF ; HERE I want to add new line $txt &= "TEST4" & @TAB & "2013-1-17" & @TAB & "some text" & @LF $txt &= "TEST4" & @TAB & "2013-1-18" & @TAB & "some text" & @LF $txt &= "TEST4" & @TAB & "2013-1-18" & @TAB & "some text" & @LF ; HERE I want to add new line $txt &= "TEST5" & @TAB & "2013-1-21" & @TAB & "some text" & @LF $txt &= "TEST5" & @TAB & "2013-1-21" & @TAB & "some text" & @CRLF ; HERE I want to add new line $txt &= "TEST 5" & @TAB & "2013-1-21" & @TAB & "some text" & @LF ;$txt = StringRegExpReplace($txt, '((?<=\v|^)([^\t]+).+\R(?!\2))', '$1' & @crlf ) ; mikell's original ;$txt = StringRegExpReplace($txt, '((?<=\v|^)([^\t]+).+\R(?!\2|\z))', '$1' & @crlf ) ; mikell's corrected for trailing @LF. $txt = StringRegExpReplace($txt, '(?m)((^[^\t]+)\V+\R(?!\2|\z))', '$1' & @CRLF) ; Malkey's corrected for trailing @LF. ConsoleWrite($txt & @LF)
    1 point
  20. UEZ

    variable into wildcard

    This worked for me, both files will be showed: I created these 2 files in c:\temp (Test_getname_001.txt and Test_getname_002.txt) and used this code from help file: $var = "00" ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("C:\temp\*getName_" & $var & "*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) Br, UEZ
    1 point
×
×
  • Create New...