Leaderboard
Popular Content
Showing content with the highest reputation on 04/17/2012 in all areas
-
2 points
-
[NEW VERSION] - 2 Aug 18 Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used New UDF and example in the zip below. Details of previous versions: Changelog.txt A forum query about the small pop-ups that some apps produce from the systray led me to create my version of how this can be done. By the way, I call these small GUIs "Toasts" for obvious reasons! A zip containing the UDF, an example script and my StringSize UDF (which is also required): Toast.zip As always, kind comments and constructive criticisms welcome - particularly the former! M231 point
-
Link to pages with general resources description MSDN - Resources OverView & Reference You can embed any binary data into your AutoIt compiled EXE files in it's resources at compile time. As opposite to FileInstall() with resources you can use your embedded data directly without any temporary files on disk. If you wish you can save resources to disk with _ResourceSaveToFile() however. Adding data to resources can be done simply by AutoIt3Wrapper directive: #AutoIt3Wrapper_Res_File_Add=FileName, ResType, ResName As data can be used for example images,cursors,texts,sounds,videos,binary files etc. For loading/using data from resources at run time I made this tiny helper Resources UDF. Functions inside UDF: _ResourceGet($ResName, $ResType = $RT_RCDATA, $ResLang = 0, $DLL = -1) _ResourceGetAsString($ResName, $ResType = $RT_RCDATA, $ResLang = 0, $DLL = -1) _ResourceGetAsStringW($ResName, $ResType = $RT_RCDATA, $ResLang = 0, $DLL = -1) _ResourceGetAsBytes($ResName, $ResType = $RT_RCDATA, $ResLang = 0, $DLL = -1) _ResourceGetAsImage($ResName, $ResType = $RT_RCDATA, $DLL = -1) _ResourceGetAsBitmap($ResName, $ResType = $RT_RCDATA, $DLL = -1) _ResourceSaveToFile($FileName, $ResName, $ResType = $RT_RCDATA, $ResLang = 0, $CreatePath = 0, $DLL = -1) _ResourceSetImageToCtrl($CtrlId, $ResName, $ResType = $RT_RCDATA, $DLL = -1) _SetBitmapToCtrl($CtrlId, $hBitmap) _ResourcePlaySound($ResName, $Flag = 0, $DLL = -1) Notes: * to compile all script examples you must have installed Scite4AutoIt3 --> you must compile script by F7 from full Scite * for using #AutoIt3Wrapper_Res_File_Add directive you must have AutoIt3Wrapper at least version 2.0.1.22 (it's part of latest Scite4AutoIt3) * to compile all script examples must be apropriate resource data files in script directory (from resource_data.zip) * _ResourceGet() always returns pointer to data (for RT_BITMAP returns hBitmap), returning other types can be done by additional wrapper functions like _ResourceGetAsString() or _ResourceGetAsBytes() * _ResourceGetAsStringW() is for Unicode strings (Widechar) * you can use also #number instead of resource name, see examples * general supported resource types are listed in UDF as constants ($RT_BITMAP, $RT_RCDATA, ...) * information about playing video files (AVI) from resources is here thanks matrixnz * information/examples about using animated GIFs from resources is here and here thanks smashly/ProgAndy * information about running EXE files/DLL functions directly from resources is here thanks trancexx/Ward Known problems/limitations: * _ResourceGet() returns resource size (in bytes) in @extended macro but not for resource type RT_BITMAP * _ResourceSetImageToCtrl() works with "static/button" type of controls (picture,label,icon,button,checkbox,radiobutton,groupbox) * _ResourcePlaySound() plays only WAV files (not MP3 files) * _ResourceGetAsBytes() doesn't work for RT_BITMAP type because _ResourceGet() returns hBitmap instead of memory pointer in this case there could be used _ResourceGetAsImage() as workaround * _ResourceGet() has potential memory leak releasing of resources UnlockResource,FreeResource (opposite of LoadResource,LockResource) is not done because it must be done after using of resources at the end and not inside UDF * _GDIPlus_Startup() is called once at start of whole include --> no _GDIPlus_Shutdown() is called History: 2011-06-20 - fixed x64 compatibility (type: int->ptr) - internal change: FindResourceA -> FindResourceW (& type: str->wstr) - _SetBitmapToCtrl() --> $CtrlId parameter now supports also -1 (thanks guinness) - _WinAPI_LoadLibraryEx($DLL, $LOAD_LIBRARY_AS_DATAFILE) instead of _WinAPI_LoadLibrary($DLL) (thanks arcker) - added au3.user.calltips.api, au3.userudfs.properties (thanks guinness) - merged resource_au3.zip + resource_data.zip to one file resources.zip 2010-02-12 - all examples now use fixed #AutoIt3Wrapper_Res_File_Add directive from latest Scite4Autoit3 (no need for ResHacker.exe) - added support for buttons (also checkboxes,radiobuttons,groupboxes) in _ResourceSetImageToCtrl()/_SetBitmapToCtrl() thanks Melba 2009-08-25 - fixed corrupted topic (appeared after forum upgrade) - removed some AU3 tags from topic, note: all AU3 code is untouched inside attached ZIP 2008-11-27 - added _ResourceGetAsStringW() --> for Unicode strings (Widechar) 2008-11-10 - added two very simple examples 2008-08-14 - change: _GDIPlus_Startup() is called once at start of whole include--> no _GDIPlus_Shutdown() is called - fixed support for animated GIFs in _ResourceGetAsImage() --> removed_MemGlobalFree($hData) - used simpler UDF syntax (from WinAPI) instead of DllCall() where possible - added new example for animated GIF image 2008-07-08 - just corrected some typos in this topic (no code changes) 2008-06-25 - big thanks to ProgAndy for ideas,improvements! - added _ResourceGetAsImage(), _ResourceGetAsBitmap() - added optional $DLL parameter to all functions - for loading resources from external EXE,DLL files - fixed previous limitation in _ResourceSaveToFile() - now supports also RT_BITMAP type - new examples in resource_test.au3 2008-05-02 - added new RT,SND constants - fixed bad order of parameters ResName x ResType in FindResourceExA (thanks SmOke_N) - added DeleteObject of oldBmp from STM_SETIMAGE in _SetBitmapToCtrl (thanks ProgAndy) - added settinng SS_BITMAP style to control before STM_SETIMAGE in_SetBitmapToCtrl (support for labels) 2008-04-24 - added support for JPG,GIF,PNG in _ResourceSetImageToCtrl() using GDI+ - thanks ProgAndy - reverted all examples back from #AutoIt3Wrapper_Res_File_Add= to#AutoIt3Wrapper_run_after=ResHacker.exe -add - updated both ZIP archives 2007-10-16 - added _ResourcePlaySound() - thanks Larry - corrected local declaration of $struxt - was problem when Opt("MustDeclareVars",1) - updated resource_test.au3 and resource.au3 in resource_au3.zip 2007-09-14 - added optional parameter $CreatePath in _ResourceSaveToFile() - updated resource_test.au3 and resource.au3 in resource_au3.zip 2007-09-11 - in examples used new AutoIt3Wrapper directive#AutoIt3Wrapper_Res_File_Add from latest Scite4AutoIt3 (instead of #AutoIt3Wrapper_run_after=ResHacker.exe -add ...) - updated resource_test.au3 and resource_test_ie.au3 in resource_au3.zip 2007-09-05 - in #AutoIt3Wrapper_run_after=ResHacker.exe -add ... directive can be resource type in text form -->rcdata instead of 10, bitmap instead of 2 and so on (note: but for htmlmust be used 23 still) - updated only resource_test.au3 in resource_au3.zip 2007-09-04 - added description at top of this topic - added _ResourceSaveToFile() - source is also example for using _ResourceGetAsBytes() - more error checking in UDF and error codes are now differrent todistinguish possible problem - default ResType = 10 ($RT_RCDATA) in all functions - updated both ZIP archives 2007-08-29 - added TODO list - removed not used local variables in _ResourceSetImageToCtrl() - ziparchive not updated yet - revisited WWW links and TODO list and added list of functions 2007-08-10 - first version resource_test_min1.au3 - very simple example script of using UDF #AutoIt3Wrapper_Res_File_Add=image3.jpg, rt_rcdata, TEST_JPG_1 #include "resources.au3" $gui = GUICreate("Data from resources simple example 1",400,150) $pic1 = GUICtrlCreatePic("",0,0,400,150) _ResourceSetImageToCtrl($pic1, "TEST_JPG_1") ; set JPG image to picture control from resource GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = -3 Then Exit WEnd resource_test.au3 - complex example script of using UDF #AutoIt3Wrapper_Res_File_Add=test_1.txt, rt_rcdata, TEST_TXT_1 #AutoIt3Wrapper_Res_File_Add=image1.bmp, rt_bitmap, TEST_BMP_1 #AutoIt3Wrapper_Res_File_Add=image2.bmp, rt_bitmap, TEST_BMP_2 #AutoIt3Wrapper_Res_File_Add=image3.jpg, rt_rcdata, TEST_JPG_3 #AutoIt3Wrapper_Res_File_Add=binary1.dat, rt_rcdata, TEST_BIN_1 #AutoIt3Wrapper_Res_File_Add=C:\WINDOWS\Media\tada.wav, sound, TEST_WAV_1 #include "resources.au3" $gui = GUICreate("Data from resources example",820,400) $pic1 = GUICtrlCreatePic("",0,0,400,300) $pic2 = GUICtrlCreatePic("",400,0,400,150) $pic3 = GUICtrlCreatePic("",400,150,400,150) $pic4 = GUICtrlCreatePic("",600,320,400,100) $label1 = GUICtrlCreateLabel("",20,320,380,100) $label2 = GUICtrlCreateLabel("",400,320,200,100) GUISetState(@SW_SHOW) ; get string from resource $string = _ResourceGetAsString("TEST_TXT_1") GUICtrlSetData($label1, $string) ; set BMP image to picture control from resource bitmap _ResourceSetImageToCtrl($pic1, "TEST_BMP_1", $RT_BITMAP) ; get bitmap from resource (as pointer) $hBmp = _ResourceGet("TEST_BMP_2", $RT_BITMAP) ; and use it for whatever you like _SetBitmapToCtrl($pic2, $hBmp) ; set JPG image to picture control from resource _ResourceSetImageToCtrl($pic3, "TEST_JPG_3") ; set image to picture control from external DLL resource _ResourceSetImageToCtrl($pic4, "#14355", $RT_BITMAP, @SystemDir & "\shell32.dll") ; get/use picture from resources as hImage type $size1 = _ResourceGetImageSize("TEST_BMP_1", $RT_BITMAP) $size2 = _ResourceGetImageSize("TEST_JPG_3") GUICtrlSetData($label2, $size1 & @CRLF & $size2) ; save binary data or another type (image) from resource to file and get its size in bytes $size1 = _ResourceSaveToFile(@ScriptDir & "\binary_data1.dat", "TEST_BIN_1") $size2 = _ResourceSaveToFile(@ScriptDir & "\binary_data2.bmp", "TEST_BMP_1", $RT_BITMAP) ; save binary data from resource to file (create not existing directory) _ResourceSaveToFile("C:\Dir1\SubDir2\binary_data1.dat", "TEST_BIN_1", $RT_RCDATA, 0, 1) _ResourceSaveToFile("C:\Dir1\SubDir2\binary_data2.bmp", "TEST_BMP_1", $RT_BITMAP, 0, 1) ; play WAV from resource (sync/async) _ResourcePlaySound("TEST_WAV_1") _ResourcePlaySound("TEST_WAV_1", $SND_ASYNC) While 1 If GUIGetMsg() = -3 Then Exit WEnd Func _ResourceGetImageSize($ResName, $ResType = 10) ; $RT_RCDATA = 10 ; get/use picture from resources as hImage type $hImage = _ResourceGetAsImage($ResName, $ResType) $width = _GDIPlus_ImageGetWidth ($hImage) $height = _GDIPlus_ImageGetHeight($hImage) Return "Size of " & $ResName & " is: " & $width & "x" & $height EndFunc resources.zip - UDF + examples + sample resource data for examples Previous downloads: 7195 resources.zip1 point
-
Hi all, i needed an UDF for using the Windows Taskplaner / Task Scheduler. Everything i found was based on at.exe (outdated) orbased on schtasks.exe (limited in functionality) orusing WMI (which can not see task that were not created with WMI and is also limited)The only good solution i found was here: http://www.autoit.de/index.php?page=Thread&postID=214517#post214517 But it only had a Create Function. With my limited knowledge i tried creating more functions and it seems to work quite OK. You can try it out with TestTaskSchedulerUDF(). WinVista or higher is required. All feedback is welcome, but please be kind, i do not have much practise and i am well aware that there is room for improvment. Edit: added new version of the code with more functions: Edit2: updated UDF fixed bugs Edit3: added info for multiinst parameter (_TaskCreate) Edit4: updated UDF (some bugfixes) Edit5: added version info to UDF, added changes/additions suggested in this thread (_TaskIsEnabled(), _TaskEnable(), _TaskDisable() and $duration for _TaskCreate()) Edit6: added new version that does not use a COM errorhandler (this version can be mixed with other com functions with or without errorhandler, but requires current autoit beta 3.3.9.4 or newer) - see this post for details: (if you do not need other COM routines, there is no need to change from the last version to this one, but all newer version will be without errorhandler...) Edit7: added version 5.2 with new TaskCreate option $starwhenavailable Edit8: added version 5.3 fixed versioncompare problems and some typos (now runs with latest beta 3.3.9.22) Edit9: added version 5.4 (the COM errorhandler is back :-)) As long as there is no feedback this will be the last update...for me it works like it should and i can manage all my tasks just fine! Keep in Mind that Autoit does not support using more than one ComError Function so be careful if you use other com udfs that need a com errorfunction - this is not a problem when using the taskplanerCOMneh.au3 version (neh=no error handler) No longer true - use lates version with errorhandler Now we have: Func _TestTaskSchedulerUDF()Func _TaskSchedulerAutostart();check if the schedulerservice is set to autostartFunc _TaskIsValidPlatfrom() ;check if os and autoit versions are OK for use with this udfFunc _TaskFolderCreate($folder);Create folder - only folders that do not already exist can be created without errorFunc _TaskFolderDelete($folder);Delete folder - only folders that do exist and that are empty can be deleted without errorFunc _TaskFolderExists($folder = "");check if a TaskFolder existsFunc _TaskExists($taskname, $folder = "");check if a Task existsFunc _TaskStop($taskname, $folder = "");stop a taskFunc _TaskStart($taskname, $folder = "");start a taskFunc _TaskIsRunning($taskname, $folder = "");check if a Task is runningFunc _TaskIsEnabled($taskname, $folder = "");check if a Task is enabledFunc _TaskEnable($taskname, $folder = "");Enable TaskFunc _TaskDisable($taskname, $folder = "");Disable TaskFunc _TaskDelete($taskname, $folder = "");delete an existing taskFunc _TaskListall($folder = "", $hidden = 1);get a list of all tasks in a given taskfolder (Tasknames only) List is a string with names separeted by "|"Func _TaskCreate($taskname, $TaskDescription, $TriggerEvent, $StartTrigger, $EndTrigger, $DaysOfWeek, $DaysOfMonth, $MonthOfYear, $WeeksOfMonth, $DaysInterval, $Interval, $RepetitionEnabled, $LogonType, $RunLevel, $Username, $Password, $Program, $WorkingDirectory = "", $Arguments = "", $RunOnlyIfNetworkAvailable = True, $active = True, $multiinst = 0, $nobatstart = False, $stoponBat = False, $hidden = False, $idle = False, $WakeToRun = False, $timelimit = "P1D", $priority = 5, $duration="", $StartWhenAvailable = True)taskplanerCOMneh5.2.zip taskplanerCOM_neh5.3.zip taskplanerCOM_5.4.zip1 point
-
Why would you even...? Never mind. I don't want to know.1 point
-
capturing text + doing actions
Mikeman27294 reacted to Bert for a topic
Troll, he is. Intelligent, he is not. A laughing stock he will be. Checking the BS gauge I am...1 point -
Latest Beta
jaberwacky reacted to Valik for a topic
Special Note: This is an alpha release. No installer is provided for this release, only the stand-alone SFX archive. This alpha release contains a couple major changes to the language which can radically change the way scripts are written. The highlights are: The $ in variables is now optional. If you want to continue using $ to prefix your variables that is fine and will continue to be supported. If you'd rather drop the $ that is fine, too, though be aware you cannot have variables with the same name as functions unless you prefix the variable with $.Functions are now first class objects. That means you can assign a function to a variable an invoke that function through the variable. It is similar in behavior to function pointers. This is very useful for callbacks as well as writing interfaces that are decoupled from their implementation.3.3.9.5 (17th April, 2012) (Alpha) The following changes are script breaking changes: NOTE: WinAPIEx is included in this release. The files exist but there are no documentation or examples. Filenames and functions are subject to change or removal. Functions will be moved out to other files before the final release and the file WinAPIEx.au3 will likely not exist when that happens. Report issues here. Download here.1 point -
Read kinda chaptcha w/ autoit?
BrewManNH reacted to JohnQSmith for a topic
Here is the first place to look.1 point -
ObjectCreatInterface() <- helpfile1 point
-
OutlookEX UDF
footswitch reacted to water for a topic
Every function in the UDF comes with a help file (html). There you can find a description of every parameter. If the parameter is an enumeration of Outlook values you find the enumeration name in the help file. The enumeration can be found in the file "OutlookExConstants.au3". A link to the details for this enumeration on MSDN can be found there as well. Example: Function _OL_FolderAccess takes an enumeration as parameter $iOL_FolderType. The docu referres to the OlDefaultFolders enumeration. This is described in the "OutlookExConstants.au3" file as ; OlDefaultFolders Enumeration. Specifies the folder type for the current Outlook profile. ; See: http://msdn.microsoft.com/en-us/library/bb208072.aspx Global Const $olFolderCalendar = 9 ; Calendar folder Global Const $olFolderContacts = 10 ; The Contacts folder Global Const $olFolderDeletedItems = 3 ; The Deleted Items folder Global Const $olFolderDrafts = 16 ; The Drafts folder Global Const $olFolderInbox = 6 ; The Inbox folder Global Const $olFolderJournal = 11 ; The Journal folder Global Const $olFolderJunk = 23 ; The Junk E-Mail folder Global Const $olFolderNotes = 12 ; The Notes folder Global Const $olFolderOutbox = 4 ; The Outbox folder Global Const $olFolderSentMail = 5 ; The Sent Mail folder Global Const $olFolderTasks = 13 ; The Tasks folder Global Const $olFolderToDo = 28 ; The To Do folder Global Const $olFolderRssFeeds = 25 ; The RSS Feeds folder Section "See:" points you to MSDN Please check the help file for function _OL_FolderAccess or the Wiki Access the users mailbox and then run function _OL_FolderTree. The valid properties depend on the item type. A mail item is different compared to a contact item. You have to check MSDN docu. Example: Mail item properties can be found here (Outlook 2007). Searching in Outlook is quite complex. Searching for dates is even more complex. It depends on the date/time format of your country. I would use ">" and "<" to compare date/time so you can easily get all mails in a time frame. Sure. To save a mail item use function _OL_ItemSave. Everything you want to do should be possible with the UDF. I suggest you start coding, post questions if a problem arises and I will do my very best to solve them. N.B.: A very good source to understand this UDF is the Wiki (still work in progress).1 point -
GuiCtrlCreateInput focus (typing) and enable radio button
footswitch reacted to Melba23 for a topic
ttleser, Best way is to look for changes to the input content and then en/disable the radio like this: #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> GUICreate("test", 400, 300) GUICtrlCreateLabel("UserName", 10, 10, 110, 20) $UserName = GUICtrlCreateInput("", 130, 10, 100, 20) GUICtrlCreateLabel("ComputerName", 10, 50, 110, 20) $ComputerName = GUICtrlCreateInput("", 130, 50, 100, 20) $Radio_SearchProfileOnly = GUICtrlCreateRadio("User Profile Only?", 250, 10, 100, 20) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) GUICtrlSetState(-1, $GUI_CHECKED) $Radio_SearchEntireDrive = GUICtrlCreateRadio("Entire Drive?", 250, 50, 100, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 ; Sleep(50) ; Not needed as there is a GUIGetMsg in the loop $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $ComputerName GUICtrlSetState($Radio_SearchEntireDrive, $GUI_ENABLE) EndSelect WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from the correct input If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $ComputerName Then If GUICtrlRead($ComputerName) = "" Then GUICtrlSetState($Radio_SearchEntireDrive, $GUI_DISABLE) Else GUICtrlSetState($Radio_SearchEntireDrive, $GUI_ENABLE) EndIf EndIf EndFunc ;==>_WM_COMMANDIf you are not used to GUIRegisterMsg, then I recommend the GUIRegisterMsg tutorial in the Wiki. M231 point