Jump to content

Search the Community

Showing results for tags 'format'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 14 results

  1. Hi, i have a variable (floating number - could be positive or negative), i wish to print it into a text file, how can i keep the format in such a way that it always has 4 digits ahead of decimal and 2 after decimal basically i have total 7 columns in the text file to print the variable ; eg: variable = 1.235, output requied = 0001.24 variable=-23.55555, output required =-023.56
  2. Hello Dear Sirs, I have a question please About UPDown ctrl Where I want to adjust its format For example, I want to create a window to set the clock like the window in the system Can this be done? here's the example ______ #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <UpDownConstants.au3> goto() func Goto() local $wGoto = GUICreate("go to spissific position", 250, 180, @DesktopWidth / 2 - 192, @DesktopHeight / 2 - 235, -1) GUICtrlCreateLabel("please write a corect position to go to it", 50, 10, 220, 20) GUICtrlCreateLabel("hours", 0, 80, 100, 30) local $Inp1 = GUICtrlCreateInput("00", 0, 90, 100, 20, $ES_NUMBER + $WS_TABSTOP) GUICtrlCreateUpdown($Inp1, $UDS_ARROWKEYS) GUICtrlSetLimit(-1, 23, 0) GUICtrlCreateLabel("minuts", 110, 80, 100, 30) local $Inp2 = GUICtrlCreateInput("00", 110, 90, 100, 20, $ES_NUMBER + $WS_TABSTOP) GUICtrlCreateUpdown($Inp2, $UDS_ARROWKEYS) GUICtrlSetLimit(-1, 60, 0) GUICtrlCreateLabel("seconds", 220, 80, 100, 30) local $Inp3 = GUICtrlCreateInput("00", 220, 90, 100, 20, $ES_NUMBER + $WS_TABSTOP) GUICtrlCreateUpdown($Inp3, $UDS_ARROWKEYS) GUICtrlSetLimit(-1, 60, 0) local $Ok = GUICtrlCreateButton("&ok", 0, 150, 50, 30, 0x01) local $cancel = GUICtrlCreateButton("&cancel", 200, 150, 50, 30) GUISetState(@sw_show, $WgoTo) while 1 switch GUIGetMSG() case $GUI_Event_Close, $cancel exit case $OK local $read1 = GUICtrlRead($inp1) if $read1 >= 1 then $Read1 = ($Read1*60)*60 local $read2 = GUICtrlRead($inp2) if $read2 >= 1 then $Read2 = $Read2*60 local $read3 = GUICtrlRead($inp3) GUIDelete($WgoTo) Return $read1+$read2+$read3 exit endSwitch Wend EndFunc ________ What I need is to be the contents of the inputs as follows when i change the value of the UPDown CTRL 00 01 02 03 ...
  3. I have established how to get tomorrows date however I can't seem to figure out how to format the date into my required format of MM/DD/YYYY. I have this: $today=_DateToDayValue(@YEAR,@MON,@MDAY) Dim $Y, $M, $D $tomorrow=_DayValueToDate($today+1, $Y, $M, $D) The _DateToDayValue seems to have a fixed format. I've also tried a : $vardate = _DateAdd( 'd',1, _NowCalcDate()) with a "StringSplit" and/or StringFormat but the _NowCalcDate seems to also be fixed to a YYYY/MM/DD format. I'm sure I'm missing something simple but am at a loss. Any help would be MUCH appreciated
  4. I have a text file which has over 1000 lines, and I wish to replace one particular - I was able to do the replacement - but I have a issue - I want the numbers to be of specific format Eg; my command was as follows, my command >>>>> _filewritetoline($inp_file,$inp_replacement,"WAVE1.00STOK"&$hdet&" "&$tasso&" "&"270.0 D 5.0 72MS 1",true) my output >>>>>> WAVE1.00STOK10.06 9.800 270.0 D 5.0 72MS 1 how do I make sure that the $hdet=10.06 is printed as 10.060(3 digits after decimel) and same with $tasso and so on.. also, how to maintain the required gap between the variables - is it by manually putting spaces ? thanks guys
  5. Hi everyone. I want to format the output of _INetGetSource to look nice and pretty. Example google.com source output: <!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script>(function(){window.google={kEI:'DJtTWvCOI6WGjwSE9JrICg',kEXPI:'18167,1354277,1354916,1355218,1355675,1355793,1356171,1356806,1357219,1357326,3700304,3700519,3700521,4003510,4029815,4031109,4043492,4045841,4048347,4081038,4081164,4095909,4096834,4097153,4097195,4097922,4097929,4098733,4098740,4098752,4102237,4102827,4103475,4103845,4106084,4107914,4109316,4109490,4112770,4113217,4115697,4116349,4116724,4116731,4116926,4116927,4116935,4117980,4118798,4119032,4119034,4119036,4120285,4120286,4120660,4121175,4121518,4122511,4123830,4123850,4124091,4124850,4125837,4126202,4126754,4126869,4127262,4127418,4127473,4127744,4127863,4128586,4128622,4129001,4129520,4129556,4129633,4130362,4130783,4131247,4131834,4132956,4133114,4133509,4135025,4135088,4135249,4135934,4136073,4136092,4136137,4137597,4137646,4140792,4140849,4141281,4141707,4141915,4142071,4142328,4142420,4142443,4142503,4142678,4142729,4142829,4142834,4142847,4143278,4143527,4143902,4144442,4144550,4144704,4145074,4145075,4145082,4145088,4145461,4145485,4145622,4145688,4145713,4145836,4146146,4146183,4146874,4147032,4147043,4147096,4147443,4147800,4147951,4148257,4148304,4148436,4148498,4148573,6512220,10200083,10202524,10202562,15807763,19000288,19000423,19000427,19001999,19002287,19002288,19002366,19002548,19002880,19003321,19003323,19003325,19003326,19003328,19003329,19003330,19003407,19003408,19003409,19004309,19004516,19004517,19004518,19004519,19004520,19004521,19004531,19004656,19004668,19004670,19004692,41317155',authuser:0,kscs:'c9c918f0_DJtTWvCOI6WGjwSE9JrICg',u:'c9c918f0',kGL:'US'};google.kHL='en';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};google.ml=function(){return null};google.wl=function(a,b){try{google.ml(Error(a),!1,b)}catch(d){}};google.time=function(){return(new Date).getTime()};google.log=function(a,b,d,c,g){if(a=google.logUrl(a,b,d,c,g)){b=new Image;var e=google.lc,f=google.li;e[f]=b;b.onerror=b.onload=b.onabort=function(){delete e[f]};google.vel&&google.vel.lu&&google.vel.lu(a);b.src=a;google.li=f+1}};google.logUrl=function(a,b,d,c,g){var e="",f=google.ls||"";d||-1!=b.search("&ei=")||(e="&ei="+google.getEI(c),-1==b.search("&lei=")&&(c=google.getLEI(c))&&(e+="&lei="+c));c="";!d&&google.cshid&&-1==b.search("&cshid=")&&(c="&cshid="+google.cshid);a=d||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+b+e+f+"&zx="+google.time()+c;/^http:/i.test(a)&&google.https()&&(google.ml(Error("a"),!1,{src:a,glmm:1}),a="");return a};}).call(this);(function(){google.y={};google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};}).call(this);google.f={};var a=window.location,b=a.href.indexOf("#");if(0<=b){var c=a.href.substring(b+1);/(^|&)q=/.test(c)&&-1==c.indexOf("#")&&a.replace("/search?"+c.replace(/(^|&)fp=[^&]*/g,"")+"&cad=h")};</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important} But I want it outputted like this: <!doctype html> <html itemscope="" itemtype="http://schema.org/WebPage" lang="en"> <head> <meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"> <meta content="noodp" name="robots"> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"> <title>Google</title> <script> (function() { window.google = { kEI: 'DJtsdfgWGjwSE9JrICg', kEXPI: '18167,1354277,1354916,1355218,1355675,1355793,1356171,1356806,1357219,1357326,37sdfg0304,3700519,3700521,4003510,4029815,4031109,4043492,4045841,4048347,4081038,4081164,4095909,4096834,4097153,4097195,4097922,4097929,4098733,4098740,4098752,4102237,4102827,4103475,4103845,4106084,4107914,4109316,4109490,4112770,4113217,4115697,4116349,4116724,4116731,4116926,4116927,4116935,4117980,4118798,4119032,4119034,4119036,4120285,4120286,4120660,4121175,4121518,4122511,4123830,4123850,4124091,4124850,4125837,4126202,4126754,4126869,4127262,4127418,4127473,4127744,4127863,4128586,4128622,4129001,4129520,4129556,4129633,4130362,4130783,4131247,4131834,413sdfg56,4133114,4133509,4135025,4135088,4135249,4135934,4136073,4136092,4136137,4137597,4137646,4140792,4140849,4141281,4141707,4141915,4142071,4142328,4142420,4142443,4142503,4142678,4142729,4142829,4142834,4142847,4143278,4143527,4143902,4144442,4144550,4144704,4145074,4145075,4145082,4145088,4145461,4145485,4145622,4145688,4145713,4145836,4146146,4146183,4146874,4147032,4147043,4147096,4147443,4147800,4147951,4148257,4148304,4148436,4148498,4148573,6512220,10200083,10202524,10202562,15807763,19000288,190sdfg23,19000427,19001999,19002287,19002288,19002366,19002548,19002880,19003321,19003323,19003325,19003326,19003328,19003329,19003330,19003407,19003408,19003409,19004309,19004516,19004517,19004518,19004519,19004520,19004521,19004531,19004656,19004668,19004670,19004692,41317155', authuser: 0, kscs: 'c9c918f0_DJtTWvCOI6WGjwSE9JrICg', u: 'c9c918f0', kGL: 'US' }; google.kHL = 'en'; })(); ....... I checked the forums and did not see any UDFs that allow for this. I see the Chilkat UDF but that only supports JSON. Any help would be greatly appreciated.
  6. To get the current time stamp, I got the below code. #include <Date.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #RequireAdmin ; Under Vista the Windows API "SetSystemTime" may be rejected due to system security $td = _Date_Time_GetSystemTime() $td = _Date_Time_SystemTimeToDateTimeStr($td) $td = StringReplace($td, " ", "_") $td = StringReplace($td, ":", "_") MsgBox(0,"",$td) But it is not giving the date or time of the timezone where the system is there. Please suggestt
  7. I am not sure what is happing at all, unfortunatlly there is no way I can put a full running code. When I enter the first and last name it works fine, However when I get to the date of birth it puts in '19760703000000' I can't figure out why "7/3/1976" is the value before the formant and "07031976" is after the format. I want it to pull the value after the format. "07031976" $r = 1 Local $aArray = _Excel_RangeRead($oExcel, Default, Default,Default,False) For $i = 1 To UBound($aArray) - 1 ;$i =0 Start from row A $sR1 = $aArray[$i][0] ;status $sR2 = $aArray[$i][1] ;first name $sR3 = $aArray[$i][2] ;Last name $sR4 = $aArray[$i][4] ;DOB $sR5 = $aArray[$i][5] ;Email Address WinWaitActive ("[CLASS:Notepad]") ControlSend("[CLASS:Notepad]", "", "Edit1", $sR3 & ',' & $sR2 & @CR) Sleep (2000) ControlSend("[CLASS:Notepad]", "", "Edit1",("{TAB}")) Sleep (3000) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR4 & @CR) ControlSend("[CLASS:Notepad]", "", "Edit1",("{ENTER}")) ControlSend("[CLASS:Notepad]", "", "Edit1",("{F12}") $r = $r + 1 If $r > $sBox Then Exit Endif Next auto it demo.xlsx - excel that I am using. Edit: I also want to mention I have tried Local $aArray = _Excel_RangeRead($oExcel, Default, Default,3) When I do this not even the name first and last name will write.
  8. How a lot of string formatted output to a printer? E.g: 1) The first line of Arial font and size 20 and Bold 2) The second line to the fourth line of Tahoma font and size 14 3) Insert two blank lines every 5 row 4) Every 64 rows to add a page break (chr(12) ) and add headers and footers 5) Finally, the formatted string output to a printer(Dot matrix printer) How to do that?The printer supports ESC / P, ESC / P2, ESC / PK, ESC / PK2, Epson Standard Code for Printer. Thank you very much!!!
  9. Does anyone know about OLE2 Compound Document Format and how can be extracted embedded files?
  10. I searched for this oddity for a while but found no results. If I missed it, my apologies. I have an app that I am building that will eventually search a SQL database for results within a specified range of time. To collect the range of time required but the user, I have 2 fields I created, one for start and the other for end times. They are formatted "yyyy/MM/dd HH:MM:ss" for entry. The fields are created with this: $dpStartDate = GUICtrlCreateDate(_NowCalc(), 112, 88, 146, 24) $dpEndDate = GUICtrlCreateDate(_NowCalc(), 416, 88, 146, 24) I am setting the format of the fields with this code: $DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW $style = "yyyy/MM/dd hh:mm:ss" GUICtrlSendMsg($dpStartDate, $DTM_SETFORMAT_, 0, $style) GUICtrlSendMsg($dpEndDate, $DTM_SETFORMAT_, 0, $style) What I am attempting to do is when the start field is updated, compare it with the end time field. If the end time is less than the start time, make both fields match. When I attempt to do so with the function below, The end time date is copied correctly but the time (hour) is reset to 1, no matter the time entered. Am I going about updating the field incorrectly? As an example, I set the date in the start field to "2013/08/23 11:47:38", the end time field gets set to "2013/08/23 01:00:00" Func dpStartDateChange() Local $stDT = GUICtrlRead($dpStartDate), $edDT = GUICtrlRead($dpEndDate) If $edDT < $stDT Then MsgBox(0,"Change Needed","End Time: "&$edDT&@CRLF&"Start Time: "&$stDT) ;Shows correct time GUICtrlSetData($dpEndDate,$stDT) EndIf EndFunc There is no code for SQL in place yet. I am working on some of the GUI logic for now. Let me know if there is enough code here or you need more.
  11. What is TrIDLib.dll? This standard Win32 DLL library, based on TrID's core engine, make adding file identification / file recognition capabilities to any kind of application a very easy & quick process. If you need a managed library, check the TrIDEngine. For more Info Go to Author website http://mark0.net/index-e.html Functions in the UDF are: _TrIDLib_Startup _TrIDLib_Shutdown _TrIDLib_GetInfo _TrIDLib_GetRealExtension _TrIDLib_GetVersion _TrIDLib_GetFileTypeDef Here is main udf: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include-once ; TrIDlib AutoIt Demo[Modified] ; #INDEX# ======================================================================================================================= ; Title .........: 7Zip ; AutoIt Version : 3.3.8.1 ; Language ......: English ; Description ...: Functions that assist with TrIDLib DLL. ; Author(s) .....: Gajjar Tejas ; Notes .........: The original code came from this subject : http://mark0.net/download/tridlib-samples.zip ; - 12 June 2013 : ; * Intial ; * Added _TrIDLib_GetInfo, _TrIDLib_GetVersion, _TrIDLib_GetFileTypeDef,_TrIDLib_Startup, _TrIDLib_Shutdown,_TrIDLib_GetRealExtension ; * 32bit dll Version(v1.0.2.0). ; * Auto Open Dll, Manually Close ; - Note ; * Using _TrIDLib_Startup() and _TrIDLib_Shutdown() is recommanded for multiples Files. ; * The last x32 DLL file can be found here : http://mark0.net/code-tridlib-e.html ; * The last Definition file can be found here : http://mark0.net/soft-trid-e.html ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_TrIDLib_Startup ;_TrIDLib_Shutdown ;_TrIDLib_GetInfo Auto Open dll*** ;_TrIDLib_GetVersion Auto Open dll ;_TrIDLib_GetFileTypeDef Auto Open dll ;***Using _TrIDLib_Startup() and _TrIDLib_Startup() is recommanded for multiples Files to avoid ; repetitive dll open that can increase operation time. ;***If _TrIDLib_Startup is not specified then dll will open and close automatically for _TrIDLib_GetInfo() ; =============================================================================================================================== ; #VARIABLES# =================================================================================================================== ; Definations & dll File Global $sTridDllFile = @ScriptDir & "\TrIDLib.dll" Global $sTridDefDir = @ScriptDir Global $sTridDefFile = $sTridDefDir & "\triddefs.trd" ; Others Global $iTridIsDllOpen = 0 ;Default Dll is not opened. Global $hTridDll = 0 ;Handle to Dll Global $iTridAutoLoad = 1 ;Default auto load Dll ; Constants FOR TrID_GetInfo Const $TRID_GET_RES_NUM = 1 ;Get the number of results available Const $TRID_GET_RES_FILETYPE = 2 ;Filetype descriptions Const $TRID_GET_RES_FILEEXT = 3 ;Filetype extension Const $TRID_GET_RES_POINTS = 4 ;Matching points Const $TRID_GET_VER = 1001 ;TrIDLib version (major * 100 + minor) Const $TRID_GET_DEFSNUM = 1004 ;Number of filetypes definitions loaded ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib ; Description ...: Identify file types from their binary signatures. ; Syntax ........: _TrIDLib($sFile) ; Parameters ....: $sFile - A full path of file. ; Return values .: Success - Returns the array (n x 4) with results ; n = Total No of possible file type found(UBound(array, 1)) ; array[0][0] = File Type 1st instant ; array[0][1] = Extension " ; array[0][2] = Points " ; array[0][3] = % Point " ; ... ; array[n-1][0] = File Type (n-1)th instant ; array[n-1][1] = Extension " ; array[n-1][2] = Points " ; array[n-1][3] = % Point " ; Failure - Returns 0 and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; |3 = While Opening TrIDLib.dll(DllOpen) ; |4 = While Loading triddefs.trd(DllCall) ; |5 = While Submitting File(DllCall) ; |6 = While Analysing File(DllCall) ; |7 = Unable to detect file type(DllCall) ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _TrIDLib_GetInfo($sFile) If $iTridAutoLoad Then _TrIDLib_Startup() If @error Then Return SetError(@error, 0, 0) $iTridAutoLoad = 1 Else ;Check if Manually Load Using _TrIDLib_Startup and previously dll open or not If Not $iTridIsDllOpen Then _TrIDLib_Startup() If @error Then Return SetError(@error, 0, 0) EndIf EndIf ; load the definitions Local $Ret = DllCall($hTridDll, "int", "TrID_LoadDefsPack", "str", $sTridDefDir) If @error Then Return SetError(4, 0, 0) ; submit the file $Ret = DllCall($hTridDll, "int", "TrID_SubmitFileA", "str", $sFile) If @error Then Return SetError(5, 0, 0) ; perform the analysis $Ret = DllCall($hTridDll, "int", "TrID_Analyze") If @error Then Return SetError(6, 0, 0) Local $Buf $Ret = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_RES_NUM, "int", 0, "str", $Buf) Local $iTotalSumPoints = 0 Local $RetCom If $Ret[0] > 0 Then Local $aTridLibInfoInform2D[$Ret[0]][4] For $ResId = 0 To $Ret[0] - 1 ;Get File Type $RetCom = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_RES_FILETYPE, "int", $ResId + 1, "str", $Buf) $aTridLibInfoInform2D[$ResId][0] = $RetCom[3] ;First Element ;Get Extension $RetCom = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_RES_FILEEXT, "int", $ResId + 1, "str", $Buf) $aTridLibInfoInform2D[$ResId][1] = $RetCom[3] ;Second Element ;Get Points $RetCom = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_RES_POINTS, "int", $ResId + 1, "str", $Buf) $aTridLibInfoInform2D[$ResId][2] = $RetCom[0] $iTotalSumPoints += Number($aTridLibInfoInform2D[$ResId][2]) ;Third Element Next ;Get Points in Percentage If $iTotalSumPoints > 0 Then For $ResId = 0 To $Ret[0] - 1 $aTridLibInfoInform2D[$ResId][3] = Round($aTridLibInfoInform2D[$ResId][2] * 100 / $iTotalSumPoints, 2) ;Fourth Element Next EndIf Else Return SetError(7, 0, 0) EndIf If $iTridAutoLoad Then _TrIDLib_Shutdown() Return $aTridLibInfoInform2D EndFunc ;==>_TrIDLib_GetInfo ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_GetRealExtension ; Description ...: ; Syntax ........: _TrIDLib_GetRealExtension($sFile) ; Parameters ....: $sFile - A full path of file. ; Return values .: Success - Returns the Original File Extension ; Failure - Returns Empty String('') and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; |3 = While Opening TrIDLib.dll(DllOpen) ; |4 = While Loading triddefs.trd(DllCall) ; |5 = While Submitting File(DllCall) ; |6 = While Analysing File(DllCall) ; |7 = Unable to detect file type(DllCall) ; |8 = File was Identified But Extension Not Found in the Database(null('') extension return by dll) ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _TrIDLib_GetRealExtension($sFile) Local $at = _TrIDLib_GetInfo($sFile) Local $iErr = @error Local $sExt = $at[0][1] If Not $iErr Then If $sExt <> "" Then $sExt = "." & $sExt Else Return SetError(8, 0, '');null extension return by dll EndIf Else Return SetError($iErr, 0, '') EndIf Return $sExt EndFunc ;==>_TrIDLib_GetRealExtension ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_GetVersion ; Description ...: Get the TrIDLib.dll version ; Syntax ........: _TrIDLib_GetVersion() ; Parameters ....: ; Return values .: Success - Returns Numrical - Version ; Failure - Returns 0 and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; |3 = While Opening TrIDLib.dll(DllOpen) ; |4 = While Loading triddefs.trd(DllCall) ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _TrIDLib_GetVersion() ;Check if is dll open or not If Not $iTridIsDllOpen Then _TrIDLib_Startup() If @error Then Return SetError(@error, 0, 0) EndIf ;Get TrIDLib version Local $Buf Local $RetCom = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_VER, "int", 0, "str", $Buf) Return Round($RetCom[0] / 100, 2) EndFunc ;==>_TrIDLib_GetVersion ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_GetFileTypeDef ; Description ...: Get the total no of Definitions triddefs.trd ; Syntax ........: _TrIDLib_GetFileTypeDef() ; Parameters ....: ; Return values .: Success - Returns Numrical - Version ; Failure - Returns 0 and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; |3 = While Opening TrIDLib.dll(DllOpen) ; |4 = While Loading triddefs.trd(DllCall) ; Author ........: Your Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TrIDLib_GetFileTypeDef() ;Check if is dll open or not If Not $iTridIsDllOpen Then _TrIDLib_Startup() If @error Then Return SetError(@error, 0, 0) EndIf ; load the definitions DllCall($hTridDll, "int", "TrID_LoadDefsPack", "str", $sTridDefDir) If @error Then Return SetError(4, 0, 0) ;Get Number of filetypes definitions loaded Local $Buf Local $RetCom = DllCall($hTridDll, "int", "TrID_GetInfo", "int", $TRID_GET_DEFSNUM, "int", 0, "str", $Buf) Return $RetCom[0] EndFunc ;==>_TrIDLib_GetFileTypeDef ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_CheckFiles ; Description ...: Check File ; Syntax ........: _TrIDLib_CheckFiles() ; Parameters ....: ; Return values .: Success - Returns 1 ; Failure - Returns 0 and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TrIDLib_CheckFiles() If Not FileExists($sTridDllFile) Then Return SetError(1, 0, 0) ElseIf Not FileExists($sTridDefFile) Then Return SetError(2, 0, 0) Else Return SetError(0, 0, 1) EndIf EndFunc ;==>_TrIDLib_CheckFiles ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_Startup ; Description ...: Manually Load TrIDLib.dll ; Syntax ........: _TrIDLib_Startup() ; Parameters ....: ; Return values .: Success - Returns 1 ; Failure - Returns 0 and and sets @error to non zero ; |1 = TrIDLib.dll File Not Found.(FileExist) ; |2 = Triddefs.trd File Not Found(FileExist) ; |3 = While Opening TrIDLib.dll(DllOpen) ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TrIDLib_Startup() _TrIDLib_CheckFiles() If @error Then Return SetError(@error, 0, 0) $hTridDll = DllOpen($sTridDllFile) If $hTridDll = -1 Then Return SetError(3, 0, 0) $iTridIsDllOpen = 1 $iTridAutoLoad = 0 Return SetError(0, 0, 1) EndFunc ;==>_TrIDLib_Startup ; #FUNCTION# ==================================================================================================================== ; Name ..........: _TrIDLib_Shutdown ; Description ...:Manually Unload TrIDLib.dll ; Syntax ........: _TrIDLib_Shutdown() ; Parameters ....: ; Return values .: None ; Author ........: Gajjar Tejas ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _TrIDLib_Shutdown() DllClose($hTridDll) $iTridAutoLoad = 1;Default auto load $iTridIsDllOpen = 0 EndFunc ;==>_TrIDLib_Shutdown Example:1 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #Region ;************ Includes ************ #Include "_TrIDLib.au3" #include <Array.au3> #EndRegion ;************ Includes ************ _Example() Func _Example() MsgBox(0, "Info", _ "TrIDLib.dll version (major * 100 + minor): " & _TrIDLib_GetVersion() & @CRLF & _ "Number of filetypes definitions loaded:" & _TrIDLib_GetFileTypeDef()) Local $sFile, $at, $iErr $sFile = FileOpenDialog("Choose Any File", "", "Any File (*.*)", 3) ; a file to analyze If @error Then Exit $at = _TrIDLib_GetInfo($sFile) $iErr = @error If Not $iErr Then MsgBox(0, "Info", "Total No of possible file type found:" & UBound($at, 1)) MsgBox(0, "Info", "Suggested Extension:" & _TrIDLib_GetRealExtension($sFile)) _ArrayDisplay($at, "Result", -1, 0, "", "|", "No.|File Type|Extension|Points|% Points") Else Switch $iErr Case 1 MsgBox(0, "Error", "TrIDLib.dll File Not Found in Script Directory.") Case 2 MsgBox(0, "Error", "triddefs.trd File Not Found in Script Directory.") Case 3 MsgBox(0, "Error", "Error occurs during opening TrIDLib.dll") Case 4 MsgBox(0, "Error", "Error occurs during Loading triddefs.trd.") Case 5 MsgBox(0, "Error", "Error occurs during Submitting File: " & $sFile) Case 6 MsgBox(0, "Error", "Error occurs during Analysing File: " & $sFile) Case 7 MsgBox(0, "Error", "Unable to detect file type") Case 8 MsgBox(0, "Error", "File was Identified But Extension Not Found in the Database(null extension return by dll)") EndSwitch EndIf EndFunc ;==>_Example Example:2 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #Region ;************ Includes ************ #Include "_TrIDLib.au3" #EndRegion ;************ Includes ************ _Example() Func _Example() ;Load Dll _TrIDLib_Startup() ;Select Folder Local $sDir = FileSelectFolder("choose folder", "") If @error Then Exit If StringRight($sDir, 1) <> "\" Then $sDir &= "\" ;Search Handle Local $search = FileFindFirstFile($sDir & "*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf MsgBox(0, "Info", "Now,Press Ok to See Console Output") Local $at, $iErr = 0 While 1 ;Search for file and Folder Local $sFile = FileFindNextFile($search) If @error Then ExitLoop ;Only file allowed If StringInStr(FileGetAttrib($sDir & $sFile), "D") = 0 Then ConsoleWrite("==============================================================" & @LF) ConsoleWrite(">File: " & $sDir & $sFile & @LF) ;Get detailed info in array $at = _TrIDLib_GetInfo($sDir & $sFile) $iErr = @error If Not $iErr Then ConsoleWrite("Total no of possible file type found:" & UBound($at, 1) & @LF) ConsoleWrite("-Suggested extension:" & $at[0][1] & @LF) For $i = 0 To UBound($at) - 1 ConsoleWrite($i + 1 & "==============" & @LF) ConsoleWrite("File Type:" & $at[$i][0] & @LF) ConsoleWrite("Extension:" & $at[$i][1] & @LF) ConsoleWrite("Points:" & $at[$i][2] & @LF) ConsoleWrite("Points %:" & $at[$i][3] & @LF) Next Else Switch $iErr Case 1 ConsoleWrite("!Error: TrIDLib.dll File Not Found in Script Directory.") Case 2 ConsoleWrite("!Error: triddefs.trd File Not Found in Script Directory.") Case 3 ConsoleWrite("!Error: Error occurs during opening TrIDLib.dll") Case 4 ConsoleWrite("!Error: Error occurs during Loading triddefs.trd.") Case 5 ConsoleWrite("!Error: Error occurs during Submitting File: " & $sFile) Case 6 ConsoleWrite("!Error: Error occurs during Analysing File: " & $sFile) Case 7 ConsoleWrite("!Error: Unable to detect file type") EndSwitch ConsoleWrite(@LF) EndIf EndIf WEnd ; Close the search handle FileClose($search) ;Close Dll _TrIDLib_Shutdown() EndFunc ;==>_Example This udf require the following components: TrIDLib.dll - The last x32 DLL file can be found here : http://mark0.net/code-tridlib-e.html triddefs.trd - The last Definition file can be found here : http://mark0.net/soft-trid-e.html Includes in Download: Examples, triddefs.trd and TrIDLib.dll _TrIDLib.7z This is my first udf Hope you will like.
  12. Hello everyone. At the moment, I am writing a program for which I want to be able to copy plain text (with HTML formatting) and turn it into formatted text (like the result you would get if you copied the formatted text rather than the HTML code). I hope that makes sense. Has anybody ever attempted this before / is this possible without having to paste it into a browser or text box or anything, just make calculations and place it back on the clipboard? Thanks.
  13. I tried searching for similar topics but I'm not entirely sure what the proper wording would be, so here goes. You know how there are programs like JDownloader that you can copy the whole text of a page and they'll sort it out and give you only the list of direct download urls inside it? How do they do that? I'd like to make something similar just for fun, maybe make a search in google images and get a list of all the filenames, or for useful codes later on like working with a lot of documents and maybe I'd like a list of all the phone numbers in them, or addresses, I don't know. Any suggestions? relevant functions? Thanks in advance!
  14. I've got a tab delimited text file that needs column headers added. As you might be able to see it's for an Amazon Order confirmation File. With my current experience with autoit I figured the best way to make this happen would be to use excel. Only problem is that excel is being a punk and changing my numbers to short hand. The numbers that are being changed are FedEx Tracking numbers like: 064089467117955 End up like this: 6.40895E+13 So i was looking for a better way to do this or a way to prevent my cells from being changed. Here's my Code: FileCopy("Y:\New Folder\HOLDFILEEXPORT.txt", "C:\Amazon\HOLDFILEEXPORT.txt", 1) FileCopy("C:\Amazon\HOLDFILEEXPORT.txt", "C:\Amazon\HOLDFILEEXPORT.xls", 1) $oExcel = _ExcelBookAttach("C:\Amazon\HOLDFILEEXPORT.xls") _ExcelRowInsert($oExcel, 1, 1) Sleep(10) _ExcelWriteCell($oExcel, "order-id", 1, 1) Sleep(10) _ExcelWriteCell($oExcel, "order-item-id", 1, 2) Sleep(10) _ExcelWriteCell($oExcel, "quantity", 1, 3) Sleep(10) _ExcelWriteCell($oExcel, "ship-date", 1, 4) Sleep(10) _ExcelWriteCell($oExcel, "carrier-code", 1, 5) Sleep(10) _ExcelWriteCell($oExcel, "carrier-name", 1, 6) Sleep(10) _ExcelWriteCell($oExcel, "tracking-number", 1, 7) Sleep(10) _ExcelWriteCell($oExcel, "ship-method", 1, 8) Sleep(10) _ExcelBookClose($oExcel)
×
×
  • Create New...