Leaderboard
Popular Content
Showing content with the highest reputation on 06/26/2019 in all areas
-
Microsoft's documentation now says that the Windows Logo key shortcuts are reserved for the system and can't be remapped to another hotkey. https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registerhotkey2 points
-
StringSplit Input and insert into Loop
chrisgreece reacted to Subz for a topic
Just re-read your code it should be something like: #include <Array.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $aInput GUICreate("Example", 320, 120) Local $idInput = GUICtrlCreateInput("aa-bbb-cccc-dddd", 10, 5, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn $aInput = StringSplit(GUICtrlRead($idInput), "-") _ArrayDisplay($aInput) For $i = 1 To $aInput[0] MsgBox(4096, "Using $aInput[0]", $aInput[$i]) Next For $i = 1 To UBound($aInput) - 1 MsgBox(4096, "Using Ubound", $aInput[$i]) Next EndSwitch WEnd EndFunc1 point -
StringSplit Input and insert into Loop
chrisgreece reacted to Subz for a topic
Try For $i = 1 To $input[0] Or For $i = 1 To Ubound($Input) - 11 point -
I suggest recommend to use ListView witch checkboxes. I use it in many my projects and I'm very satistfied with it.1 point
-
Use of variables
Earthshine reacted to Jos for a topic
should be DirCreate (@AppDataDir & "\" & MyApp) Jos1 point -
GUI design more clearly with much checkboxes
Aelc reacted to Earthshine for a topic
I take my inspiration for GUIs in AutoIt from a script on this forum GUITemplate.au31 point -
Silent Install application
maniaczs reacted to Earthshine for a topic
You are most welcome, however, what if, on a users box, their windows was installed to a D or E or whatever drive? you might consider fixing the code so it uses the systems defined Program Files location, then finish off the string. like so Run (@ProgramFilesDir &'\BECOWare\TapTalk M-6200 Series Model S-6200\Default USB Drivers\dpinstx64.exe /S') Global $sProgFiles86 = EnvGet("ProgramFiles(x86)") Run("setup.exe /qn") Run ($sProgFiles86 &'\BECOWare\TapTalk M-6200 Series Model S-6200\Default USB Drivers\dpinstx64.exe /S') Now it should always work1 point -
HTML FORM IF..then
Ilounah reacted to JLogan3o13 for a topic
Are you reading the html with javascript, or with AutoIt?1 point -
Silent Install application
Earthshine reacted to maniaczs for a topic
@earthshine - Geez I didn't even thing to look there. Thank you very much!1 point -
Try different pages for certain classes rather than having everything all on one page, i.e. a drop down list and different pages for tooltips, border effects, Q event handlers, etc.1 point
-
Windows 10, (Windows Key + letter) doesn't work
Xandy reacted to argumentum for a topic
must be a reserved key for the newer versions of the OS You can look for a free one #include <MsgBoxConstants.au3> HotKeySet("{ESC}", "Terminate") Global $iret, $letter = Asc('j') Do $iret = HotKeySet("#" & Chr($letter), "ShowMessage") If Not $iret Then $letter += 1 If $letter > 200 Then ConsoleWrite(@CRLF & '! none found !!!' & @CRLF& @CRLF) MsgBox($MB_SYSTEMMODAL, "", 'No Win + "letter" worked.' , 2) Exit 5 EndIf Until $iret ConsoleWrite(@CRLF & 'The key is Win + ' & Chr($letter) & @CRLF& @CRLF) MsgBox($MB_SYSTEMMODAL, "", 'The key is Win + ' & Chr($letter), 2) While 1 Sleep(100) WEnd Func Terminate() Exit EndFunc ;==>Terminate Func ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>ShowMessage Do change the title of the first post and add "[Solved]", as there is no bug and does work ( other than reserved )1 point -
I get 0 back from the hotkeyset command, meaning it failed to set the key. Might be a bug, or a documentation error.1 point
-
Silent Install application
maniaczs reacted to Earthshine for a topic
Run("setup.exe /qn") Run ('C:\Program Files (x86)\BECOWare\TapTalk M-6200 Series Model S-6200\Default USB Drivers\dpinstx64.exe /S') That code works 100%, every time. You need to run it manually and capture what exe installers run to know what to do. look at your processes1 point -
The issue is elsewhere: since it's sooo easy to detect AutoIt exes, cheap AV companies believe it's a valuable move for to flag them all. That increases their "success rate" at zero cost since they can't care less about false positives... Call that " security through genocide".1 point
-
Peace Equalizer shows power of AutoIt
PeterVerbeek reacted to Skeletor for a topic
This is fantastic @PeterVerbeek. A great program indeed. The GUI is really inviting. Well done. Going to download and test it....1 point -
MySQL UDFs (without ODBC)
Daymond reacted to argumentum for a topic
the link at https://www.autoitscript.com/forum/topic/85617-mysql-udfs-without-odbc/?do=findComment&comment=1421885 is functional.1 point -
Hello. It seems to be an array of values. I wrote this example to illustrate it better. Local $tvarlist = DllStructCreate("ptr[3]") Local $sString="Croacia" Local $tstring = DllStructCreate("wchar string[" & StringLen($sString) +2 & "]") $tstring.String =$sString DllStructSetData($tvarlist, 1, 10, 1) DllStructSetData($tvarlist, 1, 1856, 2) DllStructSetData($tvarlist, 1, DllStructGetPtr($tstring), 3) Local $tOutput = DllStructCreate("wchar Value[1024]") Local $sString = "Nikola Tesla nació el %ld de julio de %ld en Smiljan, %s." Local $aCall = DllCall("User32.dll", "int", "wvsprintfW", "ptr", DllStructGetPtr($tOutput), "wstr", $sString, "ptr", DllStructGetPtr($tvarlist)) ConsoleWrite($tOutput.Value & @CRLF) Saludos1 point
-
MySQL UDFs (without ODBC)
Daymond reacted to bullmoose20 for a topic
I am trying to read LONGBLOB data from a remote MySQL db, and then display the retrieved image/pic in an autoIT GUI. Would you have any examples of how to do this? Briefly, what the below does is insert an image on my c:\ drive to a remote MySQL server. Using MySQL Workbench, I can see the image is stored as a BLOB and that the image looks fine when I open up the BLOB with Workbench. The next part is where I am having difficulties. I am able to run the select, but clearly, since the data is a BLOB, it does not view properly in the different methods that ProgAndy uses in his included test.au3 file since he is displaying it as a string array. I was wondering what I could do to have the image show up in a very simple autoIT gui? #include <array.au3> #include <mysql.au3> dim $file="C:\Users\nickz\Downloads\complexe_Test_SuiviClientLePheonix\images\3281-3281.jpg" dim $f_handle _MySQL_InitLibrary() $MysqlConn = _MySQL_Init() $connected = _MySQL_Real_Connect($MysqlConn,"host","user","password","dbname") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif $f_handle=FileOpen($file,16) if @error <> 0 Then MsgBox(0,"Error:","file open error " & @error & @CRLF) EndIf $contents=FileRead($f_handle,FileGetSize($file)) if @error <> 0 Then MsgBox(0,"Error:","file read error " & @error & @CRLF) EndIf $bmp=String($contents) ;$query="INSERT INTO complexe_Test_SuiviClientLePheonix.tblCLIENTEXTENTION(attachement) values(" & $bmp & ")" $query="UPDATE `complexe_Test_SuiviClientLePheonix`.`tblCLIENTEXTENTION` SET `attachement`=" & $bmp & " WHERE `NoClient`='3281'" _MySQL_Real_Query($MysqlConn, $query) ;MsgBox(0,"SQL",$query) if @error <> 0 Then MsgBox(0,"Error:","SQL statement failed error =" & @error & @CRLF) EndIf ;~ address is a blob filed in the database $query="SELECT attachement from `complexe_Test_SuiviClientLePheonix`.`tblCLIENTEXTENTION` WHERE `NoClient`='3281'" _MySQL_Real_Query($MysqlConn, $query) $res = _MySQL_Store_Result($MysqlConn) msgbox(0,"",$query) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) MsgBox(0, "", $rows & "-" & $fields) ConsoleWrite("DataType=" & VarGetType($res) & @LF) ConsoleWrite("DataType=" & VarGetType($fields) & @LF) ConsoleWrite("DataType=" & VarGetType($rows) & @LF) ; Zugriff 1 MsgBox(0, '', "Zugriff Methode 1- Handarbeit") Dim $array[$rows][$fields] For $k = 1 To $rows $mysqlrow = _MySQL_Fetch_Row($res,$fields) $lenthsStruct = _MySQL_Fetch_Lengths($res) For $i = 1 To $fields $length = DllStructGetData($lenthsStruct, 1, $i) $fieldPtr = DllStructGetData($mysqlrow, 1, $i) $data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1) $array[$k - 1][$i - 1] = $data Next Next _ArrayDisplay($array) ; Zugriff 2 MsgBox(0, '', "Zugriff Methode 2 - Reihe für Reihe") _MySQL_Data_Seek($res, 0) ; nur zum zum Zurücksetzen an den Anfang der Abfrage Do $row1 = _MySQL_Fetch_Row_StringArray($res) If @error Then ExitLoop _ArrayDisplay($row1) Until @error MsgBox(0, '', "Zugriff Methode 3 - alles in ein 2D Array") $array = _MySQL_Fetch_Result_StringArray($res) _ArrayDisplay($array) ; Feldinformationen MsgBox(0, '', "Zugriff Feldinformationen") Dim $arFields[$fields][3] For $i = 0 To $fields - 1 $field = _MySQL_Fetch_Field_Direct($res, $i) $arFields[$i][0] = _MySQL_Field_ReadValue($field, "name") $arFields[$i][1] = _MySQL_Field_ReadValue($field, "table") $arFields[$i][2] = _MySQL_Field_ReadValue($field, "db") Next _ArrayDisplay($arFields) ; Cleanup _MySQL_Free_Result($res) _MySQL_Close($MysqlConn) _MySQL_EndLibrary() msgbox(0,"","DONE") exit(0)1 point -
I use this template in my projects: #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #region GLOBAL VARIABLES Global $iW = 600, $iH = 400, $iT = 52, $iB = 52, $iLeftWidth = 150, $iGap = 10, $hMainGUI #endregion GLOBAL VARIABLES _MainGui() Func _MainGui() Local $hFooter, $nMsg, $aPos Local $iLinks = 5 Local $sMainGuiTitle = "Sample Title" Local $sHeader = "Sample GUI" Local $sFooter = "2012 © AutoIt" Local $aLink[$iLinks], $aPanel[$iLinks] $aLink[0] = $iLinks - 1 $aPanel[0] = $iLinks - 1 $hMainGUI = GUICreate($sMainGuiTitle, $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP)) GUISetIcon("shell32.dll", -58, $hMainGUI) GUICtrlCreateLabel($sHeader, 48, 8, $iW - 56, 32, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 14, 800, 0, "Arial", 5) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateIcon("shell32.dll", -131, 8, 8, 32, 32) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("", 0, $iT, $iW, 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT) GUICtrlCreateLabel("", $iLeftWidth, $iT + 2, 2, $iH - $iT - $iB - 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUICtrlCreateLabel("", 0, $iH - $iB, $iW, 2, $SS_SUNKEN);separator GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT) $hFooter = GUICtrlCreateLabel($sFooter, 10, $iH - 34, $iW - 20, 17, BitOR($SS_LEFT, $SS_CENTERIMAGE)) GUICtrlSetTip(-1, "AutoIt Forum", "Click to open...") GUICtrlSetCursor(-1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT) ;add links to the left side $aLink[1] = _AddNewLink("Link 1") $aLink[2] = _AddNewLink("Link 2", -167) $aLink[3] = _AddNewLink("Link 3", -222) $aLink[4] = _AddNewLink("Link 4", -22) ;and the corresponding GUI's $aPanel[1] = _AddNewPanel("Title for the panel 1") $aPanel[2] = _AddNewPanel("Title for the panel 2") $aPanel[3] = _AddNewPanel("Title for the panel 3") $aPanel[4] = _AddNewPanel("Title for the panel 4") ;add some controls to the panels _AddControlsToPanel($aPanel[1]) GUICtrlCreateEdit("", 10, 37, $iW - $iLeftWidth + 2 - 20 - 5, $iH - $iT - $iB - 40, BitOR($ES_AUTOVSCROLL, $ES_NOHIDESEL, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_STATICEDGE) Local $sTestTxt = "" For $i = 1 To 10 $sTestTxt &= @TAB & "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum felis lectus, pharetra vel laoreet nec, pulvinar nec justo. Donec malesuada, nunc eu faucibus sodales, diam sem tempor neque, id condimentum turpis nunc vel lacus. Nulla a nulla libero, eget eleifend dolor. Vivamus volutpat tincidunt ultricies. Vestibulum eu libero nisi, quis tincidunt nisi. Proin tincidunt, ipsum ullamcorper posuere venenatis, libero nulla venenatis enim, ultrices tincidunt ipsum arcu nec turpis. In at erat sed ipsum gravida mattis in at felis. Vivamus diam purus, dictum ut luctus vitae, sollicitudin ut velit. Maecenas velit mauris, fringilla ut condimentum bibendum, aliquam a neque. Nulla metus eros, commodo id dictum in, interdum sed ipsum. Vivamus feugiat, mi at auctor fringilla, libero lectus vulputate tortor, eu sollicitudin nulla lacus at neque." & @CRLF $sTestTxt &= @TAB & "Sed vel ante magna. Curabitur porttitor ante in tellus bibendum non tristique diam volutpat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In tellus lectus, ultrices in tempus eget, sollicitudin quis eros. Curabitur at arcu bibendum massa feugiat euismod at a felis. Nunc molestie, enim non ornare tincidunt, ipsum nisi tempus sapien, quis elementum elit velit ut neque. Suspendisse eu adipiscing risus. Nam tempor odio ut elit auctor rhoncus. Etiam viverra elit id felis feugiat pellentesque pretium porttitor dui. Vivamus eu quam non ante suscipit vehicula a nec eros. Phasellus congue massa sed libero interdum ullamcorper. Quisque fringilla massa ut lorem fringilla pulvinar eget ullamcorper eros. Praesent faucibus, erat at consequat tempus, nulla erat sodales mi, eget sagittis nibh erat nec nunc. Phasellus risus nibh, porta viverra pretium nec, vehicula eget nisi." & @CRLF $sTestTxt &= @TAB & "Sed vel neque vel urna elementum accumsan feugiat quis mauris. Sed mi nisl, consequat dapibus molestie ac, rutrum ut elit. Praesent sed risus sem. Mauris rutrum blandit magna nec tristique. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse consequat iaculis odio nec cursus. Duis varius tincidunt ligula ac ultricies. Ut eget magna in nulla vulputate dapibus ut vel sem. Integer ac tempor risus." & @CRLF $sTestTxt &= @TAB & "Maecenas molestie semper turpis, id tristique nibh pharetra eget. Aliquam erat volutpat. In egestas, lorem quis varius vestibulum, enim diam porta lorem, quis dictum arcu ante a diam. Nullam vel nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam ut leo purus, eget vulputate augue. Fusce et est sagittis felis accumsan sollicitudin eget a lectus. Cras sapien sapien, rutrum eu tempor non, tempor nec velit. Vivamus interdum adipiscing felis in malesuada. Fusce quis purus est, eget molestie turpis. In hac habitasse platea dictumst." & @CRLF $sTestTxt &= @TAB & "Aenean eleifend risus vitae lorem laoreet facilisis. Suspendisse ac urna quam, vel rutrum sem. Sed bibendum porta tellus malesuada scelerisque. Vestibulum at ligula sed nulla sollicitudin tincidunt. Pellentesque mi magna, vulputate et aliquam a, auctor et nunc. Phasellus feugiat fringilla accumsan. Donec ultrices, elit id dapibus auctor, nunc odio viverra lorem, non commodo mi libero a libero. Cras vitae felis venenatis augue laoreet tincidunt scelerisque id odio. Proin lorem purus, molestie feugiat pretium nec, ornare aliquam turpis. " Next GUICtrlSetData(-1, $sTestTxt) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM) _AddControlsToPanel($aPanel[2]) GUICtrlCreateLabel("Label1", 8, 38, 36, 17) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $hInput1 = GUICtrlCreateInput("Input1", 56, 35, 121, 21) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $hButton1 = GUICtrlCreateButton("Button1", 200, 33, 75, 25) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) _AddControlsToPanel($aPanel[3]) GUICtrlCreateList("", 8, 37, 121, 93, -1, 0) GUICtrlSetData(-1, "dfgdfg|ertert|kljlkj|poipoi|qweqwe") GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) _AddControlsToPanel($aPanel[4]) GUICtrlCreateGroup("Group1", 8, 35, 129, 90) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Local $aChkBox[4] For $i = 1 To 3 $aChkBox[$i] = GUICtrlCreateRadio("Some radio " & $i, 16, 56 + ($i - 1) * 20, 113, 17) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Next GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) ;set default to Panel1 GUISwitch($aPanel[1]) ;show the main GUI GUISetState(@SW_SHOW, $hMainGUI) While 1 Sleep(10) $nMsg = GUIGetMsg(1) Switch $nMsg[1] Case $hMainGUI Switch $nMsg[0] Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE $aPos = WinGetPos($hMainGUI) $iW = $aPos[2] $iH = $aPos[3] For $i = 0 To $aPanel[0] WinMove($aPanel[$i], "", $iLeftWidth + 2, $iT, $iW - $iLeftWidth + 2, $iH - $iT - $iB - 20) Next Case $aLink[1], $aLink[2], $aLink[3], $aLink[4] For $i = 1 To $aLink[0] If $nMsg[0] = $aLink[$i] Then GUISetState(@SW_SHOW, $aPanel[$i]) Else GUISetState(@SW_HIDE, $aPanel[$i]) EndIf Next Case $hFooter ShellExecute("http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/") EndSwitch Case $aPanel[2] Switch $nMsg[0] Case $hButton1 MsgBox(32, "Test", "You have " & GUICtrlRead($hInput1) & "?") EndSwitch Case $aPanel[4] Switch $nMsg[0] Case $aChkBox[1], $aChkBox[2], $aChkBox[3] For $i = 1 To 3 If GUICtrlRead($aChkBox[$i]) = $GUI_CHECKED Then MsgBox(64, "Test", "You checked nr. " & $i & "!") Next EndSwitch EndSwitch WEnd EndFunc ;==>_MainGui Func _AddNewLink($sTxt, $iIcon = -44) Local $hLink = GUICtrlCreateLabel($sTxt, 36, $iT + $iGap, $iLeftWidth - 46, 17) GUICtrlSetCursor(-1, 0) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateIcon("shell32.dll", $iIcon, 10, $iT + $iGap, 16, 16) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) $iGap += 22 Return $hLink EndFunc ;==>_AddNewLink Func _AddNewPanel($sTxt) Local $gui = GUICreate("", $iW - $iLeftWidth + 2, $iH - $iT - $iB, $iLeftWidth + 2, $iT, $WS_CHILD + $WS_VISIBLE, -1, $hMainGUI) GUICtrlCreateLabel($sTxt, 10, 10, $iW - $iLeftWidth - 20, 17, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 9, 800, 4, "Arial", 5) GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) Return $gui EndFunc ;==>_AddNewPanel Func _AddControlsToPanel($hPanel) GUISwitch($hPanel) EndFunc ;==>_AddControlsToPanel1 point