Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/05/2020 in all areas

  1. @Exit You link needs adjusting. 🧐
    2 points
  2. Try the simplespy it will tell you 1. By highlighting if it can recognise 2. Will give you example code
    1 point
  3. from SciTE doc https://www.scintilla.org/SciTEDoc.html
    1 point
  4. works like a charm : ) thanks SkysLastChance 🙈
    1 point
  5. Just for the fun of it, a creative alternative : #include <APIFilesConstants.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <WinAPIError.au3> #include <WinAPIFiles.au3> #include <WinAPIMem.au3> HotKeySet ("^!{END}", _Exit) ; in case of emergency ;-) Global $g_sPath = "C:\Apps\Temp\", $nBufferLen = 1048576 If Not FileExists($g_sPath) Then Exit MsgBox($MB_SYSTEMMODAL, 'Error', 'Unable to access folder') Local $hDirectory = _WinAPI_CreateFileEx($g_sPath, $OPEN_EXISTING, $GENERIC_READ+$GENERIC_WRITE, $FILE_SHARE_READ+$FILE_SHARE_WRITE, $FILE_FLAG_BACKUP_SEMANTICS) If @error Then Exit MsgBox($MB_SYSTEMMODAL, 'Error', 'Unable to get handle') TraySetToolTip ("Watching for folder " & $g_sPath & @LF & "Press Esc to Exit") _CreateChild () Local $pBuffer = _WinAPI_CreateBuffer($nBufferLen), $aData, $sFileName While True $aData = _WinAPI_ReadDirectoryChanges($hDirectory, _ $FILE_NOTIFY_CHANGE_FILE_NAME + _ $FILE_NOTIFY_CHANGE_DIR_NAME + _ $FILE_NOTIFY_CHANGE_ATTRIBUTES + _ $FILE_NOTIFY_CHANGE_SIZE + _ $FILE_NOTIFY_CHANGE_LAST_WRITE + _ $FILE_NOTIFY_CHANGE_LAST_ACCESS + _ $FILE_NOTIFY_CHANGE_CREATION + _ $FILE_NOTIFY_CHANGE_SECURITY, $pBuffer, $nBufferLen, 1) ; remove unnecessary notifications If Not @error Then For $i = 1 To $aData[0][0] $sFileName = $g_sPath & $aData[$i][0] If FileExists ($sFileName) Then ;_PrintThatFile ($sFileName) FileDelete ($sFileName) EndIf Next Else _WinAPI_ShowLastError('', 1) EndIf WEnd Func _Exit () Exit EndFunc Func _CreateChild () Local $sTempFile = _WinAPI_GetTempFileName (@TempDir, "~") ;MsgBox ($MB_SYSTEMMODAL,"",$sTempFile) Local $sScript = "#NoTrayIcon" & @CRLF & _ "HotKeySet ('{ESC}', _Exit)" & @CRLF & _ "While 1" & @CRLF & _ "Sleep (100)" & @CRLF & _ "WEnd" & @CRLF & _ "Func _Exit ()" & @CRLF & _ "RunWait('TaskKill /PID ' & $CmdLine[1] & ' /F', '', @SW_HIDE)" & @CRLF & _ "FileDelete (@ScriptFullPath)" & @CRLF & _ "Exit" & @CRLF & _ "EndFunc" FileWrite ($sTempFile, $sScript) Run (@AutoItExe & " " & $sTempFile & " " & @AutoItPID, @TempDir, @SW_HIDE) EndFunc
    1 point
  6. ..ok #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Ignore_Funcs=_Forked_* #include <Fork.au3> #include <MailSlot.au3>; http://www.autoitscript.com/forum/index.php?showtopic=106710 ;~ ; https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_file_notify_information ;~ Global Const $FILE_ACTION_ADDED = 0x00000001 ; The file was added to the directory. ;~ Global Const $FILE_ACTION_REMOVED = 0x00000002 ; The file was removed from the directory. ;~ Global Const $FILE_ACTION_MODIFIED = 0x00000003 ; The file was modified. This can be a change in the time stamp or attributes. ;~ Global Const $FILE_ACTION_RENAMED_OLD_NAME = 0x00000004 ; The file was renamed and this is the old name. ;~ Global Const $FILE_ACTION_RENAMED_NEW_NAME = 0x00000005 ; The file was renamed and this is the new name. Global $emendelson_watchPath = @TempDir & "\~TEST~" Global $pidFileMon = 0, $hMailSlot, $sMailSlotName = "\\.\mailslot\FFMonitorNoGUI" Global $aFILE_ACTION = StringSplit("ADDED,REMOVED,MODIFIED,OLD_NAME,NEW_NAME", ",", 0) $aFILE_ACTION[0] = "fork msg." _Fork_AutoItWinTitlePrefix("FileMonitorNoGUI") _Fork_Startup() Main() Func Main() $hMailSlot = _MailSlotCreate($sMailSlotName) If @error Then MsgBox(48 + 262144, "MailSlot", "Failed to create new account!" & @CRLF & "Probably one using that 'address' already exists.") Exit 6 EndIf OnAutoItExitRegister("GBye") $pidFileMon = _Fork_Func('_Forked_ReadDirectoryChanges("' & $emendelson_watchPath & '")', Default, '/ErrorStdOut') Local $aFileEvents, $iMessageCount While 1 If _MailSlotGetMessageCount($hMailSlot) Then $aFileEvents = ReturnArray($hMailSlot) If @error Then _DebugArrayDisplay($aFileEvents) ; error string is in $aFileEvents[0][1] ContinueLoop EndIf _DebugArrayDisplay($aFileEvents) ; here you do your thing ;) ContinueLoop EndIf Sleep(1000) ; $nMsg = GUIGetMsg() WEnd EndFunc ;==>Main Func ReturnArray($hMailSlot) Local Static $iNumberOfMessagesOverall = 0 Local $i = 0, $aData, $sData, $iSize = _MailSlotCheckForNextMessage($hMailSlot) If $iSize Then $sData = _MailSlotRead($hMailSlot, $iSize, 1) $iNumberOfMessagesOverall += 1 EndIf If StringInStr($sData, '****') Then Local $aTmp[1][4] $aTmp[0][0] = 0 $aTmp[0][1] = $sData Return SetError(1, 0, $aTmp) ; and know that there was an error to do something about it - not in this example, but you in your code ;) EndIf $aData = StringSplit($sData, '*', 0) Local $aTmp[UBound($aData) + 1][4] For $n = 1 To UBound($aData) - 3 Step 3 $i += 1 If $n > 1 Then $aTmp[$i][0] = $iNumberOfMessagesOverall & ' (' & ($n + 2) / 3 & ')' ; to show that there were Else ; more than one file action $aTmp[$i][0] = $iNumberOfMessagesOverall ; reported on that message. EndIf $aTmp[$i][1] = $aData[$n] $aTmp[$i][2] = $aFILE_ACTION[Int($aData[$n + 2])] $aTmp[$i][3] = $aData[$n + 1] If $aTmp[$i][2] = $aFILE_ACTION[0] Then $aTmp[0][3] &= ' - ( timestamp NOW is ' & @HOUR & ':' & @MIN & ':' & @SEC & '.' & @MSEC & ' )' Next ReDim $aTmp[$i + 1][4] $aTmp[0][0] = $i Return $aTmp EndFunc ;==>ReturnArray Func GBye() If $pidFileMon Then ProcessClose($pidFileMon) EndFunc ;==>GBye #Region _WinAPI_ReadDirectoryChanges fork Func _Forked_ReadDirectoryChanges($sPath) ; based on the _WinAPI_ReadDirectoryChanges() example in the help file TraySetState(2) ; $TRAY_ICONSTATE_HIDE (2) = Destroys/Hides the tray icon DirCreate($sPath) If Not FileExists($sPath) Then _MailSlotWrite($sMailSlotName, 'FileExists' & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & 'LastError = ' & 'Unable to create / find folder.' & '****') Exit 3 EndIf Local $sData, $hDirectory = _WinAPI_CreateFileEx($sPath, $OPEN_EXISTING, $FILE_LIST_DIRECTORY, BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), $FILE_FLAG_BACKUP_SEMANTICS) If @error Then $sData = _WinAPI_GetLastError() _MailSlotWrite($sMailSlotName, '_WinAPI_CreateFileEx' & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & 'LastError = ' & $sData & '****') Exit 4 EndIf Local $pBuffer = _WinAPI_CreateBuffer(8388608) While 1 $sData = __WinAPI_ReadDirectoryChanges_RetStr($hDirectory, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME, $FILE_NOTIFY_CHANGE_LAST_WRITE), $pBuffer, 8388608, 1) If Not @error Then _MailSlotWrite($sMailSlotName, $sData) Else $sData = _WinAPI_GetLastError() _MailSlotWrite($sMailSlotName, 'ReadDirectoryChanges' & @CRLF & '@error = ' & @error & @CRLF & '@extended = ' & @extended & @CRLF & 'LastError = ' & $sData & '****') Exit 5 EndIf WEnd EndFunc ;==>_Forked_ReadDirectoryChanges Func __WinAPI_ReadDirectoryChanges_RetStr($hDirectory, $iFilter, $pBuffer, $iLength, $bSubtree = 0) ; a _WinAPI_ReadDirectoryChanges mod. to return a string and save time, on this script. Local $aRet = DllCall('kernel32.dll', 'bool', 'ReadDirectoryChangesW', 'handle', $hDirectory, 'struct*', $pBuffer, _ 'dword', $iLength - Mod($iLength, 4), 'bool', $bSubtree, 'dword', $iFilter, 'dword*', 0, 'ptr', 0, 'ptr', 0) If @error Or Not $aRet[0] Or (Not $aRet[6]) Then Return SetError(@error + 10, @extended, 0) $pBuffer = $aRet[2] ; if updated by the DllCall in case of not word align Local $tFNI, $iBuffer = 0, $iOffset = 0, $sData = "", $timestamp = @HOUR & ':' & @MIN & ':' & @SEC & '.' & @MSEC Do $iBuffer += $iOffset $tFNI = DllStructCreate('dword NextEntryOffset;dword Action;dword FileNameLength;wchar FileName[' & (DllStructGetData(DllStructCreate('dword FileNameLength', $pBuffer + $iBuffer + 8), 1) / 2) & ']', $pBuffer + $iBuffer) $sData &= $timestamp & '*' & DllStructGetData($tFNI, "FileName") & '*' & DllStructGetData($tFNI, "Action") & '*' $iOffset = DllStructGetData($tFNI, "NextEntryOffset") ; the "timestamp" costs time to generate, consequently not precise, Until Not $iOffset ; but is more accurate here, than on the the other side of the IPC. Return $sData EndFunc ;==>__WinAPI_ReadDirectoryChanges_RetStr #EndRegion _WinAPI_ReadDirectoryChanges fork this is a good head start
    1 point
  7. This is a long shot, but make sure your desktop display is set to 100% if you are using a browser when clicking the image make sure your browser zoom is at a 100% as well.
    1 point
  8. Why not just throw a message box, with a Yes, No, Cancel, and execute only if they click Yes?
    1 point
  9. Mat

    Getting image size

    #Include <GDIPlus.au3> _GDIPlus_Startup () Local $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\Steveiwonder\Pictures\Untitled.png") If @error Then MsgBox(16, "Error", "Does the file exist?") Exit 1 EndIf ConsoleWrite(_GDIPlus_ImageGetWidth($hImage) & @CRLF) ConsoleWrite(_GDIPlus_ImageGetHeight($hImage) & @CRLF) _GDIPlus_ImageDispose ($hImage) _GDIPlus_ShutDown ()
    1 point
  10. Jon

    Forum Rules

    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.
    0 points
×
×
  • Create New...