Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/22/2012 in all areas

  1. Chimaera

    AutoIt Snippets

    Welcome to the AutoIt Snippets thread This section is dedicated to small reusable pieces of AutoIt code i.e. Snippets They can be added to your script to give extra functionality without writing extra code. they are varied and cover many subjects like GUI's, Maths, Networking and many others. Autoit Snippets Please visit the link above and you will find many examples to help you. Many thanks for all the work from everybody who contributed to the original Autoit Wrappers thread created by Valuater which gave us the starting point for the Wiki, and those who added their code to it like Valuater, guinness, SmOke_N, GEOSoft, Zedna, Mhz, GaryFrost and many others. Submitting Code Instructions We would also like you to have a look through your saved code and if you have examples that would be usefull to others then submit them so they can be added to the wiki for the benefit of all. After you have submitted one they will remain on the thread for a short while and after it has been added to the Wiki it will be removed from the thread shortly afterwards to keep the submissions current. Take this example by guinness #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; Checks To See If The Internet Is Connected ConsoleWrite("Internet Is Connected" & " = " & _IsInternetConnected() & @CRLF) ; ( Returns "True" Or "False" ) Func _IsInternetConnected() Local $aReturn = DllCall('connect.dll', 'long', 'IsInternetConnected') If @error Then Return SetError(1, 0, False) EndIf Return $aReturn[0] = 0 EndFunc ;==>_IsInternetConnected This is how we would like them submitted so that whoever uses the example can paste it in SciTE and it gives a result [MsgBox / ConsoleWrite Etc] that the user can see and understand. They don't have to be in a Function like the above example (Although that will be the preferred option), but they must have a way of calling the code so it gives a reproducible result. A few points to note for submissions: 1: All code to be submitted must be run with this line and have no errors or warnings. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 2: Please use Tidy on your scripts before you submit them 3: Although it is our aim to transfer all posted scripts into the Wiki listings, the final decision to do so is entirely at the discretion of the editorial panel. Remember this is NOT a UDF thread, Snippets are small functions pieces of code not large ones, if your code has more than 2-3 functions in it, you may be better looking at making a UDF. Instructions on how to make one are to be found here. UDF Standards I hope you will make use of this section and add too it to make it better for all who use AutoIt Many thanks to guinness and Melba23 for their help and advice whilst the section was being made As the Wiki is now open for editing this is the template ive used to add the sections so far In the Snippets Section This code is for adding to the Wiki only it will not work in AutoIt Leave the rest unchanged so they are similar and uniform. Note: Can we keep conversation in this thread to a minimum please, as this sections posts are deleted as they are added to the wiki, so if your chatting about a piece of code it will deleted as well. Better to discuss elsewhere, Thanks. Enjoy your coding
    1 point
  2. I just wanted to post a THANK YOU to everyone that is, and has in the past, developing the AutoIT suite and supporting software. Also, a THANK YOU to everyone on the forum who helps when people need assistance. Answers are usually prompt, and not too cryptic, to questions posted. And I actually appreciate the assistance that comes in the form of "you might want to look up ______", rather than always just tossing out the answer right there. That helps amateur developers learn more about the language and tools. Though you may not always get a "thanks" when you provide help, I hope you know that you are appreciated by many.
    1 point
  3. Yes, it is possible with GDI+. You can use this function to create it: Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0) Local $tPointF1, $pPointF1 Local $tPointF2, $pPointF2 Local $aResult $tPointF1 = DllStructCreate("float;float") $pPointF1 = DllStructGetPtr($tPointF1) $tPointF2 = DllStructCreate("float;float") $pPointF2 = DllStructGetPtr($tPointF2) DllStructSetData($tPointF1, 1, $nX1) DllStructSetData($tPointF1, 2, $nY1) DllStructSetData($tPointF2, 1, $nX2) DllStructSetData($tPointF2, 2, $nY2) $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc ;==>_GDIPlus_LineBrushCreate This function returns a brush handle which can be used with _GDIPlus_GraphicsFillRect() function to create the header you want. Br, UEZ
    1 point
  4. zivt

    Yes No Cancel MSGbox

    Run('cmd.exe' & @ComSpec & '" /k ' & $CMD2 & $file1, "data", @SW_SHOW) $file1 is parameter for $CMD2. you need add space! Run('cmd.exe' & @ComSpec & '" /k ' & $CMD2 & " " &$file1, "data", @SW_SHOW) You can also try use _RunDos Hope it helps.
    1 point
  5. Thank you so much! you were a big help Anyway you have a great christmas/Holiday Thanks again!
    1 point
  6. I didn't test it, sorry it's my fault. Here's further corrections to the code: #include <Misc.au3> main() Func main() While 1 If _IsPressed("31") Then; 31 = 1 Send("{BackSpace}") ; Delete the number 1 Send("w") EndIf Sleep(100) ; Allow time for the key to be released WEnd EndFunc But Hotkey will do the same thing: HotKeySet("1", "MySendFunc") While 1 Sleep(10) WEnd Func MySendFunc() Send("w") EndFunc
    1 point
  7. No worries, thanks for that ... still working my way through all the posts, and making my own before forgetting what I want to say. I believe I read all that once, when I considered creating a _Titlecase UDF, but decided I needed more time to take it all in, so left it for another day, which will probably never happen now. That spec is excellent, and I hope enough people are aware and follow it.
    1 point
  8. try to change the BLUETOOTH_DEVICE_INFO structure... #include Global Const $hDllBthProps = DllOpen("bthprops.cpl") Func _BluetoothFindFirstDevice() $tBLUETOOTH_DEVICE_SEARCH_PARAMS = DllStructCreate('DWORD;BOOL;BOOL;BOOL;BOOL;BOOL;BYTE;HANDLE') DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 1 , DllStructGetSize($tBLUETOOTH_DEVICE_SEARCH_PARAMS)) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 2 , False) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 3 , False) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 4 , True) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 5 , False) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 6 , True) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 7 , 30) DllStructSetData($tBLUETOOTH_DEVICE_SEARCH_PARAMS, 8 , 0) ;$SYSTEMTIME=DllStructCreate("ushort wYear;ushort wMonth;ushort wDayOfWeek;ushort wDay;ushort wHour;ushort wMinute;ushort wSecond;ushort wMilliseconds") ;DllCall("Kernel32.dll","none","GetSystemTime","ptr",DllStructGetPtr($SYSTEMTIME)) $tBLUETOOTH_DEVICE_INFO = DllStructCreate('DWORD;UINT64;ULONG;BOOL;BOOL;BOOL;word[8];word[8];WCHAR[248]') DllStructSetData($tBLUETOOTH_DEVICE_INFO,1,DllStructGetSize($tBLUETOOTH_DEVICE_INFO)) ;DllStructSetData($tBLUETOOTH_DEVICE_INFO,7,DllStructGetPtr($SYSTEMTIME)) ;DllStructSetData($tBLUETOOTH_DEVICE_INFO,8,DllStructGetPtr($SYSTEMTIME)) $RESULT = DllCall($hDllBthProps, "handle", "BluetoothFindFirstDevice", "struct*", $tBLUETOOTH_DEVICE_SEARCH_PARAMS, "struct*", $tBLUETOOTH_DEVICE_INFO) msgbox(64, "", 'Result: ' & $RESULT[0] & @crlf & 'WinAPI Error: ' & _WinAPI_GetLastErrorMessage() & @crlf & 'Error: ' & @error) EndFunc _BluetoothFindFirstDevice()
    1 point
×
×
  • Create New...