Leaderboard
Popular Content
Showing content with the highest reputation on 02/20/2018 in all areas
-
I have now added a 4th program to the mix, and decided to place all under the banner of a suite - KindEbook Suite. I believe it will be better served by having its own topic, rather than attempt to edit the first few posts in the old one - KindEbook Wishlist. It is also a chance to de-clutter and make some improvements. MAIN PROGRAM KindEbook Wishlist COMPLIMENTARY PROGRAMS AZWPlug Add Book & All Formats To Calibre UpdateFromOPF Bucket-for-URLs ConvertEbook (now replaced by Batch Ebook Convert if you wish) Redundant where KFX files are concerned. Batch Ebook Convert (new) CalibBrowser - Multi-faceted viewer for calibre (while kind of complimentary, not part of the suite proper, not a step to apply) ASSISTIVE PROGRAMS Batch Create & Run TeraCopy Timer RECOMMENDED 3RD PARTY PROGRAMS & RESOURCES calibre - Integral to the last two of my complimentary programs, and an important element of the first one. Basically an ebook database & conversion program, but also offers plenty more, especially adding ebooks to or removing ebooks from your reading device. Wikipedia Sigil - A wonderful open source ebook editor & creator. Great for fixing issues with EPUB files, especially after converting from another format. Wikipedia MobileRead Forums - Excellent resource for all things ebook. BookBub - Great advisory source for ebooks, that lets you know via email about great bargains at Amazon Kindle, Kobo, Google Play, Barnes & Noble, Apple iBooks. I still use KindEbook Wishlist with anything I obtain at Amazon via BookBub links, but usually just for a purchase record ... essentially I ADD (mostly freebies) and then immediately RELOCATE to my bought (b) user. A BIG Thanks to @willichan who told me many months ago, about BookBub. Usage Of My Programs To help others to understand about these programs and how to use them for the best benefit, I thought it best to outline how I use them, usually each and every day. Quick Summary Of Usage (in order of use) 1. KindEbook Wishlist - Amazon Kindle Wishlist, Price Checker, History of Changes, Record of Purchases. 2. Bucket-for-URLs - Assistant to KindEbook Wishlist with new ebook discoveries, if a lot of them. When BookBub freebies lead to many others at Amazon. 3. AZWPlug - Add Kindle purchases to a database and to calibre, plus get right-click detail of selected ebook file (once added to database). 4. UpdateFromOPF - Make changes or corrections to the Metadata (OPF) file in calibre. 5. Batch Ebook Convert - Convert existing ebook (usually AZW3, sometimes MOBI) to EPUB and if missing, MOBI. 6. TeraCopy Timer - Make backups locally (outside of calibre library), and to thumbstick for transfer to another PC etc. 7. Batch Create & Run - Make passworded and zipped backups to Google Drive (locally). 8. Add Book & All Formats To Calibre - Add one backup copy of each ebook (all formats) to calibre on another PC. KindEbook Wishlist AZWPlug Add Book & All Formats To Calibre UpdateFromOPF Bucket-for-URLs ConvertEbook Batch Ebook Convert1 point
-
Hello mates. I would like to share simple but very important function required durning code many *au3 files. Such as function is used by a few scripts developers on forum but most of users waste a lot of time to make his functions/tool free from errors and bugs. How is working? This function do not check errors like Scite debugger. You can be able to make something like call exceptions in Python. Think about this and think when you ran some code, no error but also do nothing. 0 information and you have to jump into own or other script to find out reason. Function: Updated 2018-02-04, 08:47 (fixed AutoIt problem with dedection @ScriptName) ;============================================================================================================================================================== ; Function: Exception ([ $sInfo = "" [, $vReturnValue = Null [, $vExtended = @extended [, $iErrorNr = @error [, $iErrorLine = @ScriptLineNumber ]]]]]) ; ; Description: Call exceptions in different *au3 files located in this same Folder. ; ; Parameter(s): $sInfo - Information about exception in code, created by yourself. ; $vReturnValue - (Default=Null) Set value to return durning exception. ; $iErrorNr - (Default=@error) Set the error manually by adding a number. ; $vExtended - (Default=@extended) Set extended manually. ; $iErrorLine - Internal use do not change! ; ; Return Value(s): $vReturnValue, ; Additional: Output string in Scite Console about debug trace. ; ; Author (s): Who cares? ;============================================================================================================================================================== Func Exception($sInfo="", $vReturnValue = Null, $iErrorLine = @ScriptLineNumber, $iErrorNr = @error, $vExtended = @extended) Dim $aArray[0] Local $sScriptPath = @ScriptFullPath Local $sCurrentScriptLine = StringLower(FileReadLine($sScriptPath, $iErrorLine)) If Not StringInStr($sCurrentScriptLine, "exception") Then Local $aInclude = FileReadToArray($sScriptPath) For $sItem In $aInclude Local $sLowerLine = StringLower($sItem) If StringInStr($sLowerLine, "#include") Then Local $sIncludeName = StringTrimLeft($sItem, 8) Local $sConvertedName = "" Local $bAdd = False Local $aDelimeter = ["<", ">"] If StringInStr($sIncludeName , "'") Then $aDelimeter[0] = "'" $aDelimeter[1] = "'" ElseIf StringInStr($sIncludeName , '"') Then $aDelimeter[0] = '"' $aDelimeter[1] = '"' EndIf Local $aSplitInclude = StringSplit($sIncludeName, "") For $sSign In $aSplitInclude If $sSign = $aDelimeter[0] And Not $bAdd Then $bAdd = True ContinueLoop ElseIf $sSign = $aDelimeter[1] And $bAdd Then ReDim $aArray[UBound($aArray) + 1] $aArray[UBound($aArray) - 1] = $sConvertedName ExitLoop EndIf If $bAdd Then $sConvertedName &= $sSign Next EndIf Next EndIf If UBound($aArray) > 0 Then For $sName In $aArray Local $sPath = @ScriptDir & "\" & $sName If FileExists($sPath) Then $sCurrentScriptLine = StringLower(FileReadLine($sPath, $iErrorLine)) If StringInStr($sCurrentScriptLine, "exception") Then $sScriptPath = $sPath ExitLoop EndIf EndIf Next EndIf Local $aFile = FileReadToArray($sScriptPath) Local $sFunctionName, $sLine Local $bFound = False For $i = 0 To $iErrorLine - 1 If $bFound Or $iErrorLine <= 0 Then ExitLoop $sLine = StringReplace($aFile[$iErrorLine - $i], @TAB, "") If StringInStr(StringLower($sLine), "func ") Then Local $aSortLine = StringSplit($sLine, '') $sLine = "" For $h = 1 To $aSortLine[0] - 1 Local $sLowerSort = StringLower($aSortLine[$h]) If $sLowerSort = "(" Then $bFound = True ExitLoop ElseIf $sLowerSort <> @TAB And $sLowerSort <> " " Then If $sLowerSort = "f" Or $sLowerSort = "u" Or $sLowerSort = "n" Or $sLowerSort = "c" Then $sLine &= $aSortLine[$h] Else If Not StringInStr($sLine, "func") Then $sLine = "" ExitLoop Else $sLine &= $aSortLine[$h] EndIf EndIf EndIf Next EndIf Next If StringLeft(StringLower($sLine), 4) <> "func" Then $sLine = "" EndIf $sFunctionName = StringTrimLeft($sLine, 4) If StringLen($sFunctionName) < 1 Then $sFunctionName = "not recognized" Else $sFunctionName &= " ( ... )" EndIf If StringLen($sInfo) < 1 Then $sInfo = "nothing about" EndIf $vRet = $vReturnValue If $vRet = Null Then $vRet = "Null" ElseIf IsArray($vRet) Then $vRet = "an Array with " & UBound($vRet) & " items" ElseIf IsBinary($vRet) Then $vRet = "binary " & $vRet ElseIf IsBool($vRet) Then $vRet = "bool " & $vRet ElseIf IsDllStruct($vRet) Then $vRet = "dll struct " & $vRet ElseIf IsFloat($vRet) Then $vRet = "float " & $vRet ElseIf IsHWnd($vRet) Then $vRet = "hwnd " & $vRet ElseIf IsInt($vRet) Then $vRet = "int " & $vRet ElseIf IsKeyword($vRet) Then $vRet = "keyword " & $vRet ElseIf IsNumber($vRet) Then $vRet = "number " & $vRet ElseIf IsObj($vRet) Then $vRet = "object " & $vRet ElseIf IsPtr($vRet) Then $vRet = "ptr " & $vRet ElseIf IsString($vRet) Then If $vReturnValue = "" or StringReplace($vRet, " ", "") = "" Then $vRet = 'empty string ""' Else $vRet = 'string "' & $vRet & '"' EndIf EndIf Local $sStruct $sStruct &= "! Exception = {" & @CRLF $sStruct &= "!" & @CRLF $sStruct &= "!" & @TAB & '"date" = ' & @YEAR & "-" & @MON & "-" & @MDAY & ", " & @HOUR & ":" & @MIN & ":" & @SEC & ", " & @MSEC & "ms," & @CRLF $sStruct &= "!" & @TAB & '"path" = ' & $sScriptPath & "," & @CRLF $sStruct &= "!" & @TAB & '"line" = ' & $iErrorLine & "," & @CRLF $sStruct &= "!" & @TAB & '"func" = ' & $sFunctionName & "," & @CRLF $sStruct &= "!" & @TAB & '"retn" = ' & $vRet & "," & @CRLF $sStruct &= "!" & @TAB & '"exten" = ' & $vExtended & "," & @CRLF $sStruct &= "!" & @TAB & '"error" = ' & $iErrorNr & "," & @CRLF $sStruct &= "!" & @TAB & '"info" = ' & $sInfo $sStruct &= @CRLF $sStruct &= "!" & @CRLF $sStruct &= "! }" & @CRLF & @CRLF ConsoleWrite($sStruct) Return $vReturnValue EndFunc ;==> Exception How to use? - Example 1 Func Example() Local $sFile = FileOpen(@ScriptDir & "\example.py") If $sFile = -1 Then Return Exception("Failed to open 'example.py', File not exist!") EndIf ; continue working EndFunc Example() Example 1 Output in Scite console: Example 2 Func Example2() Local $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1.Fake") ; added .Fake to make object wrong. If Not IsObj($oHttp) Then Return Exception("Failed to create Object in variable $oHttp.", 2.2) EndIf ; continue working EndFunc Local $vRet = Example2() ConsoleWrite("$vRet = " & $vRet & @CRLF) Example 2 Output in Scite console:1 point
-
And they say I'm just a grumpy old man..... #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() HotKeySet("{ESC}", "_Exit") While 1 Capture_Window() Sleep(5000) WEnd Func _Exit() _GDIPlus_Shutdown() Exit EndFunc Func Capture_Window() Local $hWnd = WinGetHandle("[CLASS:Notepad]") Local $w = _WinAPI_GetWindowWidth($hWnd) Local $h = _WinAPI_GetWindowHeight($hWnd) Local Const $hDC_Capture = _WinAPI_GetDC(HWnd($hWnd)) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local Const $hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("gdi32.dll", "int", "SetStretchBltMode", "hwnd", $hDC_Capture, "uint", 4) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hMemDC, $hObjectOld) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) Local Const $c1 = $aFullScreen[2] - @DesktopWidth, $c2 = $aFullScreen[3] - @DesktopHeight Local Const $wc1 = $w - $c1, $hc2 = $h - $c2 If (($wc1 > 1 And $wc1 < $w) Or ($w - @DesktopWidth > 1) Or ($hc2 > 7 And $hc2 < $h) Or ($h - @DesktopHeight > 1)) And (BitAND(WinGetState(HWnd($hWnd)), 32) = 32) Then Local $hBmp_t = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) $hBmp = _GDIPlus_BitmapCloneArea($hBmp_t, 8, 8, $w - 16, $h - 16) _GDIPlus_BitmapDispose($hBmp_t) Else $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) EndIf _WinAPI_DeleteObject($hHBitmap) Local $sSaveFileName = @ScriptDir & "\screenshot - " & @MDAY & @MON & @YEAR & '-' & @HOUR &@MIN& @SEC & ".png" _GDIPlus_ImageSaveToFile($hBmp, $sSaveFileName) EndFunc I've made some essential changes and some just to make it more portable for me... I'm sure you'll figure out what is what (note the save path change).1 point
-
What DPI ("zoom level") you have set in your local Windows Environment ?1 point
-
CodeCrypter - Encrypt your Script
Miliardsto reacted to RTFC for a topic
It means that while collecting #include files referenced in other include-files, a single pass (of this recursive search) yielded >50 new files, which at the time I wrote it was a useful red-flag for circular referencing and other pathological #include structures. If you are really including many more external UDFs at any particular include netsting level, you can bump up that threshold in CodeScanner's source, in function _BuildIncTree, ca. line 3620, e.g. replace 50 with 100: If $samecount+$largercount>100 Then Or whatever maxvalue seems reasonable in your specific circumstances.1 point -
down to 5 lines and the feeling at least 1 more should be possible with the ? operator on the GUIGetMsg(1) Local $j=0, $2=0, $amsg[]=[0,0,0,0,0], $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW),$2 = GUICtrlCreateButton($BA[0],7,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"), $2 = GUICtrlCreateButton($BA[1],77,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[2],147,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[3],217,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[4],287,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[5],7,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[6],77,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[7],147,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[8],217,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[9],287,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[10],7,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[11],77,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[12],147,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[13],217,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[14],287,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[15],7,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[16],77,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[17],147,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[18],217,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[19],287,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif") Do $aMsg = GUIGetMsg(1) ;Get as array ; Should be possible with a ? somewhere if ($aMsg[2]=0 ? $2=0 : (GUICtrlRead($aMsg[0]) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead($aMsg[0]) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($aMsg[0]) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($aMsg[0]))) and ($aMsg[0]=-3)) Then exit Until $aMsg[0] = -3 ; $GUI_EVENT_CLOSE1 point
-
That code works for me.1 point
-
Johnx, To post code please use Code tags - see here how to do it. M231 point
-
Access Excel file in sharepoint
AnonymousX reacted to water for a topic
I see _Excel_BookOpen($oExcel, "https://sharepoint.com/teams/folder/filename.xlsx") now returns @error = 2 ( Specified $sFilePath does not exist)? If true, then the following modified _Excel_BookOpen function (please call _Excel_BookOpenEX in your script) should solve the problem: ; #FUNCTION# ==================================================================================================================== ; Author ........: SEO <locodarwin at yahoo dot com> ; Modified.......: litlmike, water, GMK, willichan ; =============================================================================================================================== Func _Excel_BookOpenEX($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default, $bUpdateLinks = Default) ; Error handler, automatic cleanup at end of function Local $oError = ObjEvent("AutoIt.Error", "__Excel_COMErrFunc") #forceref $oError If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0) If StringLeft($sFilePath, "HTTP") = 0 And Not FileExists($sFilePath) Then Return SetError(2, 0, 0) ; <== Modified If $bReadOnly = Default Then $bReadOnly = False If $bVisible = Default Then $bVisible = True Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, $bUpdateLinks, $bReadOnly, Default, $sPassword, $sWritePassword) If @error Then Return SetError(3, @error, 0) Local $oWindow = $oExcel.Windows($oWorkbook.Name) If IsObj($oWindow) Then $oWindow.Visible = $bVisible ; If a read-write workbook was opened read-only then set @extended = 1 If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(0, 1, $oWorkbook) Return $oWorkbook EndFunc ;==>_Excel_BookOpenEX If yes, then I'm going to update the function in AutoIt's repository.1 point -
Access Excel file in sharepoint
AnonymousX reacted to Juvigy for a topic
Just get the link to the file - it should look like the bellow: $path = "https://sharepoint.com/teams/folder/file%20name.xlsx" $oExcel = ObjGet("", "Excel.Application") $oExcel.Application.WorkBooks.Open($path) Works great.1 point -
Read CSV contents per cell
pixelsearch reacted to mikell for a topic
Not tough at all A bit simplified but still working : $aresult = StringRegExp($sContent,'(".*?")|(?<=,|^)[^,]*(?=,|$)', 3) request : (".*?") : groups of 0 or more characters inside quotes (lazy) | : or (?<=,|^) : preceded by a comma or start of string (lookbehind) [^,]* : 0 or more non-comma characters (negated character class) (?=,|$) : followed by a comma or end of string (lookahead)1 point -
Hmm it's a workaround, to make it work in more cases this is better #Include <Array.au3> $sContent = 'New York,test,"The best place to be, if you have the money",other test,"quoted",Larry' $aresult = StringRegExp($sContent,'(?:".*?")+|(?<=,|^)[^,]*(?=,|$)', 3) _ArrayDisplay($aresult)1 point
-
How to post code on the forum
FrancescoDiMuro reacted to Jon for a topic
1 point