Leaderboard
Popular Content
Showing content with the highest reputation on 10/17/2020 in all areas
-
[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
-
Please post your code, alternatively have a look at Melba23 Toast udf:1 point
-
Just calculate the desktop width/height minus the window size. For example: #include <Array.au3> #include <AutoItConstants.au3> ;~ Example 1 Local $aTrayPos = WinGetPos("", "[CLASS: Shell_TrayWnd]") $sMessage = "" SplashTextOn("TitleFoo", $sMessage, 300, 50, $aTrayPos[2] - 325, $aTrayPos[3] - 100, $DLG_TEXTLEFT, "") For $i = 1 To 20 $sMessage = $sMessage & $i & @CRLF ControlSetText("TitleFoo", "", "Static1", $sMessage) Sleep(100) Next SplashOff() ;~ Example 2 $sMessage = "" SplashTextOn("TitleFoo", $sMessage, 300, 50, @DesktopWidth - 305, @DesktopHeight - 125, $DLG_TEXTLEFT, "") For $i = 1 To 20 $sMessage = $sMessage & $i & @CRLF ControlSetText("TitleFoo", "", "Static1", $sMessage) Sleep(100) Next1 point
-
Maybe something like: #include <Excel.au3> Local $aSentence[3] = ["I'd like this sentence to be red", "I'd like this sentence to be black", "I'd like this sentence to be red again"] Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) _Excel_RangeWrite($oWorkbook, 1, $aSentence[0] & @LF & $aSentence[1] & @LF & $aSentence[2], "A1") Local $oCell = $oWorkbook.Worksheets(1).Range("A1") ;~ $oCell.Characters(Start Character Index, Number of Characters from Start Character Index) $oCell.Characters(1,Stringlen($aSentence[0]) + 1).Font.Color = -16776961 $oCell.Characters(StringLen($aSentence[0] & @LF),Stringlen($aSentence[1]) + 1).Font.Color = 0x000000 $oCell.Characters(StringLen($aSentence[0] & @LF & $aSentence[1] & @LF),Stringlen($aSentence[2]) + 1).Font.Color = -167769611 point
-
@LukeWCS : Do you have any concerns about generating the script as .a3x file? You can provide the corresponding interpreter (AutoIt3.exe / AutoIt3_64.exe) without a full installation of AutoIt. The interpreter itself is usually classified as trustworthy by antivirus programs. BTW : AI as abbreviation for AutoIt is not the best option .1 point
-
for you to say lol, this is neat, thanks @Keve just mashed up this to call some funcs concept, let me know what else you came up with. btw, so far it doesnt work on chrome, vlc #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=y ; ---------------------------------------------------------- ; concept: Right-Click anywhere with popup Context Menu ; it it known that not all context menus are ; detectable and able to add new menu item. ; (e.g chrome, vlc and perhaps other apps) ; ---------------------------------------------------------- #include <Misc.au3> #include <GuiMenu.au3> #include <WindowsConstants.au3> #include <array.au3> Opt( "MustDeclareVars", 1 ) HotKeySet('{F1}', '_Exit') Func _Exit() Exit EndFunc Global $hMenu Global $sItemNames = "Added_xNew|Added_xOpen|Added_xCopy|Added_xPaste|Added_xSelect|Added_xClose" Global $aItemNames = StringSplit($sItemNames, '|', 2) Func Added_xNew($str) MsgBox(0, @ScriptLineNumber&': Added_xNew', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xNew', $str) EndFunc Func Added_xOpen($str) MsgBox(0, @ScriptLineNumber&': Added_xOpen', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xOpen', $str) EndFunc Func Added_xCopy($str) MsgBox(0, @ScriptLineNumber&': Added_xCopy', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xCopy', $str) EndFunc Func Added_xPaste($str) MsgBox(0, @ScriptLineNumber&': Added_xPaste', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xPaste', $str) EndFunc Func Added_xSelect($str) MsgBox(0, @ScriptLineNumber&': Added_xSelect', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xSelect', $str) EndFunc Func Added_xClose($str) MsgBox(0, @ScriptLineNumber&': Added_xSelect', $str,1) MsgBox(0, @ScriptLineNumber&': Added_xSelect', $str) EndFunc MsgBox(0, @ScriptLineNumber&': Ready?', 'Right Click anywhere with a Popup Context Menu') While 1 ; wait for Right-Click to occur While Sleep(10) And Not _IsPressed( "02", "user32.dll" ) ;01=primary, 02=secondary mouse button WEnd _popup_contextMenuDetectionAndSelection() WEnd ; concept to call func based on newly added menu item selected Func _popup_contextMenuDetectionAndSelection() Local $timeout = 3 Local $init Local $iIsItem Local $iCount Local $jCount Local $iItem Local $jItem Local $sFuncName Local $aPos ConsoleWrite('!>!'&@ScriptLineNumber&': 1st Right-Clicked - Context Menu Pop-Up'&''&@CRLF) ;Read/Brown $aPos = MouseGetPos() ToolTip('Wait '&$timeout&'secs for New Context Menus to populate)', $aPos[0]-3, $aPos[1]-30) ; $timeout seconds to locate popup context menu existence $init = TimerInit() While TimerDiff($init) < ($timeout * 1000) $hMenu = GetMenuHandle() If $hMenu Then ExitLoop sleep(10) WEnd ConsoleWrite('+>+'&@ScriptLineNumber&': $hMenu - '&$hMenu&''&@CRLF) ;Green/Grey If Not $hMenu Then ToolTip('') Send('{ESC}') Local $sMsg = 'Note: doesnt work in Chrome/VLC'&@CRLF&@CRLF& _ 'Press Ok then Right-Click to try again' MsgBox(0, @ScriptLineNumber&': Error', $sMsg, 1) MsgBox(0, @ScriptLineNumber&': Error', $sMsg, 1) MsgBox(0, @ScriptLineNumber&': Error', $sMsg, 1) MsgBox(0, @ScriptLineNumber&': Error', $sMsg, 1) Else ; $timeout seconds to get inital menu items $init = TimerInit() While TimerDiff($init) < ($timeout * 1000) $iCount = _GUICtrlMenu_GetItemCount($hMenu) If $iCount Then ExitLoop sleep(10) WEnd ConsoleWrite('-->'&@ScriptLineNumber&': $iCount '&$iCount&''&@CRLF) ;Yellow/Orange $iIsItem = _AddMenuItem_toRightClickContextMenu() ConsoleWrite('-->'&@ScriptLineNumber&': $iIsItem '&$iIsItem&''&@CRLF) ;Yellow/Orange If Not $iIsItem Then ToolTip('>>> Fails to add NEW Menu - Click anywhere to continue then Right-Click to try again <<<', $aPos[0]-3, $aPos[1]-30) Else ToolTip('>>> Now select a NEW Menu below if every added correctly <<<', $aPos[0]-3, $aPos[1]-30) ; waiting for Left-Click (click a menu item) While Sleep(10) And Not _IsPressed( "01", "user32.dll" ) ;01=primary, 02=secondary mouse button WEnd ConsoleWrite('!>!'&@ScriptLineNumber&': 2nd Left-Clicked - Item Selected'&''&@CRLF) ;Read/Brown ToolTip('') ; $timeout seconds get total menu items (old + newly added) $init = TimerInit() While TimerDiff($init) < ($timeout * 1000) $jCount = _GUICtrlMenu_GetItemCount($hMenu) If $jCount Then ExitLoop sleep(10) WEnd ConsoleWrite('!>!'&@ScriptLineNumber&': $jCount - '&$jCount&''&@CRLF) ;Read/Brown If $jCount > 0 Then $iItem = _GUICtrlMenu_MenuItemFromPointEx( 0, $hMenu ) $jItem = $jCount - $iItem - 1 ConsoleWrite('-->'&@ScriptLineNumber&': $jItem '&$jItem&' = '&$jCount& ' - '& $iItem &@CRLF) ;Yellow/Orange ; only detect newly added menu items If $jItem <= UBound($aItemNames)-1 Then _ArrayReverse($aItemNames) $sFuncName = $aItemNames[$jCount - $iItem - 1] Call($sFuncName, '(init: '&$iCount-1& ') + (new: '& UBound($aItemNames) &') + (dividers: 2) = [totalMenus: '& $jCount-1 &']' &@CRLF&@CRLF& _ 'you selected item #'&$iItem &'/'& $jCount-1 &@CRLF&@CRLF& _ 'which executes func: ' &$sFuncName & '() that clicked on'&@CRLF&@CRLF& _ 'clicked: '& $jItem&' <= '& UBound($aItemNames)-1 &' :total custom menus') _ArrayReverse($aItemNames) EndIf Else MsgBox(0, @ScriptLineNumber&': Fails', 'No menu item was Clicked', 1) MsgBox(0, @ScriptLineNumber&': Fails', 'No menu item was Clicked', 1) EndIf EndIf EndIf EndFunc Func _AddMenuItem_toRightClickContextMenu() If Not $hMenu Then Return False Local $iItemNot = True If $hMenu Then ; Add new menu item Local $iItem $iItem = _GUICtrlMenu_AddMenuItem( $hMenu, '') ;add new divider If Not $iItem Then $iItemNot = False $iItem = _GUICtrlMenu_AddMenuItem( $hMenu, '') ;add new divider If Not $iItem Then $iItemNot = False For $i=0 To UBound($aItemNames)-1 $iItem = _GUICtrlMenu_AddMenuItem( $hMenu, StringReplace($aItemNames[$i], '_', ' ')) If Not $iItem Then $iItemNot = False Next EndIf Return $iItemNot EndFunc Func GetMenuHandle() Local $hDesktop = _WinAPI_GetDesktopWindow(), $i = 0 Local $hChild = _WinAPI_GetWindow( $hDesktop, $GW_CHILD ) While $hChild And $i < 50 If _WinAPI_GetClassName( $hChild ) = "#32768" Then ExitLoop $hChild = _WinAPI_GetWindow( $hChild, $GW_HWNDNEXT ) $i += 1 WEnd If $i = 50 Then Return 0 Local $hMenu = _SendMessage( $hChild, $MN_GETHMENU ) If $hMenu > 0 Then Return $hMenu Return 0 EndFunc Func _GUICtrlMenu_MenuItemFromPointEx( $hWnd, $hMenu, $iX = -1, $iY = -1 ) If $iX = -1 Then $iX = _WinAPI_GetMousePosX() If $iY = -1 Then $iY = _WinAPI_GetMousePosY() Local $tPOINT = DllStructCreate( "long;long" ) DllStructSetData( $tPOINT, 1, $iX ) DllStructSetData( $tPOINT, 2, $iY ) Local $tPOINT64 = DllStructCreate( "int64", DllStructGetPtr( $tPOINT ) ) Local $aResult = DllCall("user32.dll", "int", "MenuItemFromPoint", "hwnd", $hWnd, "handle", $hMenu, "int64", DllStructGetData( $tPOINT64, 1 ) ) If @error Then Return SetError(@error, @extended, -1) Return $aResult[0] EndFunc here is an anomaly, right-click on SciTE title bar resulted in retaining added menu items. even after exited the code1 point
-
Hi, Below is the code I've wrote long ago and ran it very frequent without any issue. I am doing some clean up recently and revisit the code just to find out that the ReplaceTheApp() function is able to access the variable I declared in Local. How can this possible while I didn't pass any variable into the function or declare the variable in Global? Local $UpdateInfo = IniReadSection(@AppDataDir & "\AutoUpdater.ini", "Update") Local $WorkingPath = $UpdateInfo[1][1] Local $AppName = $UpdateInfo[2][1] Local $WindowsTitle = $UpdateInfo[3][1] Local $Repository = $UpdateInfo[4][1] ReplaceTheApp() Run($WorkingPath & "\" & $AppName) Func ReplaceTheApp() SplashTextOn("Updating..", "Downloading new updates for installation, please wait..", 400, 60, -1, -1) FileDelete($WorkingPath & "\" & $AppName) InetGet("https://something.com/" & $Repository & "/download/" & $AppName, $WorkingPath & "\" & $AppName) Sleep(1000) SplashOff() EndFunc Thank you.1 point
-
In the next week or so the forum will be upgraded to IPB4. I'm currently testing features with the MVPs. The upgrade should take a couple of hours so the site will be offline for that time. When it comes back online there are still about 12 hours worth of background tasks that will begin. During these background tasks a lot of content will look incorrect or be completely broken: Search offline Emoticons Quotes / Trac links / Topic links - pretty much anything with BBCodes AutoIt/Plaintext code should look correct straight away - I'm pre-converting it myself. However we will have to switch to Prettify for code highlighting and direct links from code into documentation will no longer work. Do not re-edit your old posts during this time with the intention of cleaning them up. It will happen automatically and you are just wasting time. I'll post status updates of the rebuild process and when it is complete. The new site is a responsive design and therefore works much better on small devices. There is no "mobile" skin anymore. But obviously the look might not be to everyone's taste. I'm happy to tweak the template a little to fix minor cosmetic annoyances but I'm not going to go crazy with it as all the tweaks need to be redone on each upgrade. If you want to have a taste then look the IPB main site at http://community.invisionpower.com/1 point
-
We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.1 point
-
A recent thread degenerated into personal abuse because some members posted rather sarcasticly in response to the initial question and the OP then responded with rather more venom than was probably warranted. Can I take this opportunity to remind people that we try to run a civilised and polite forum and we would appreciate it if you could act accordingly. If you do not have a sensible comment to make in response to a question, please refrain from posting at all. And, as is explained in the Forum rules, if you do get flamed just report the offending post to the moderating team so that we can deal with it. Certainly do not expect us to take sides if you engage in a flame war - all participants will be treated as equally guilty. Basically, please help us keep the forum running in the way the majority of members would like to see. Thanks in advance for your cooperation. M231 point