AutoHotkey Community

It is currently May 26th, 2012, 11:37 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 16  Next
Author Message
 Post subject:
PostPosted: November 4th, 2009, 1:19 pm 
Thanks jackie.

I did see some dll calls, however, I'm afraid I have no knowledge of how to change them to make them unicode compatible. Would be you kind enough to take a look at the script to tell me how I could make the change? :oops: :oops: :oops: :oops: :oops:

Thanks a bunch for the great that you have started on the unicode version.

Here is the script from the original garry's script: ( http://www.autohotkey.com/forum/topic34932.html )

Code:
MODIFIED =20091024            ;youtube changed 20091022 and search
;MODIFIED=20090823            ;youtube changed 20090815
;MODIFIED=20090720            ;FMT=35 and radiobox
;MODIFIED=20090119            ;youtube changed autoselect
;MODIFIED=20090107            ;extractaudio 31351 changed
;MODIFIED=20090102            ;added listview logfile
;MODIFIED=20081217            ;added checkbox
;MODIFIED=20081122            ;added radio-box to select fmt=0/18/22
;MODIFIED=20081117            ;FMT=18 FMT=22
;MODIFIED=20081026            ;added freeware converts video to MP3
FILENAME=YOUTUBE_%MODIFIED%


REC        =c:\_RECORDED1
run,%COMSPEC% /C if not exist \%REC%\NUL MD %REC%,,hide


;----    DOWNLOADS YOUTUBE FLV (fmt=35)  or MP4 (fmt=18/22) with right name and convert to MP3  ---------
;----    automatically select best quality ----------------------------------------
; player      http://www.videolan.org/   (vlc.exe)
; convert2MP3 http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe


;.............how to use ................................................
;       start this script and youtube
;       copy video link with rightclick or CTRL+c

;       download starts, downloads ---namexy.flv-- or -- namexy.mp4 --
;       when download finished possibility to convert video to MP3
;       creates a logfile start member/youtube or download again
;........................................................................


#NoEnv
SetBatchlines -1
SendMode Input

setworkingdir, %a_scriptdir%
transform,S,chr,32   ;SPACE
clipboard=

WA=%A_screenwidth%
HA=%A_screenheight%

MP3extract  =%A_programfiles%\DVDVideoSoft\Free Video to Mp3 Converter\FreeVideoToMP3Converter.exe
;ifnotexist,%MP3extract%
;   goto,mp3converter

Settitlematchmode, 2
Gui,2:default
Gui,2: +AlwaysOnTop

Gui,2:Color,black
Gui,2:Font,  S10 CDefault , Lucida Console

   transform,ten,chr,10
   transform,tre,chr,13
   CF=%TRE%%TEN%

YOUTUBEMP4INI=%A_scriptdir%\YOUTUBEMP4a.ini
ifnotexist,%YOUTUBEMP4INI%
   {
   IniWrite,0    , %YOUTUBEMP4INI%  ,Startvideo      , KEY1
   IniWrite,0    , %YOUTUBEMP4INI%  ,Beep            , KEY1
   }



;-------- menu ----------------------------------------------


     ;--------------- SETTINGS ------------------
     ;menu ,S1 ,Add,&Ask for start video after download     ,MH1
     ;menu ,S1 ,Add,&Ask for convert to MP3 after download  ,MH2

     ;-------------- TOOLS ---------------------------
     Menu,S2,add,Converter start                        ,MH11
     Menu,S2,add,Converter download                     ,MH12
     Menu,S2,add,Converter HomePage                     ,MH13

     ;menu, myMenuBar, Add, Settings      ,:S1
     menu, myMenuBar, Add, Tools         ,:S2

gui,2:menu,MyMenuBar
;----------------------------------------------------



AFC=0
TEXTCOLOR=yellow
EDITCOLOR=red


Gui,2:add, text,   x0  y0 h0 w0  vTEXT3 ,%text4%            ;text is hidden , see settimer AAS4
Gui,2:Add,Text,c%textcolor%  x10   y10                     ,URL1
Gui,2:Add,Text,c%textcolor%  x10   y40                     ,URL2
Gui,2:Add,Text,c%textcolor%  x10   y70                     ,FILENAME
Gui,2:Add,Text,c%textcolor%  x10   y100                    ,NAME
Gui,2:Add,Text,c%textcolor%  x10   y130                    ,PROCESS
Gui,2:Add,Text,c%textcolor%  x10   y160                    ,PROGRESS
Gui,2:Add,Text,c%textcolor%  x10   y190                    ,STATUS
Gui,2:Add,Text,c%textcolor%  x10   y230                    ,SEARCH


;------- for test --------------------------------------------------------------
;ALCC=http://www.youtube.com/watch?v=lH8Xcqvs3JM    ;fmt=35 China tango   (flv)
ALCC=http://www.youtube.com/watch?v=siJLeHAnZIk    ;fmt=22 chinese 1080HD Widescreen
;ALCC=http://www.youtube.com/watch?v=DJZv_U0zGGI   ;fmt=18 Ek verlang na jou
;ALCC=http://www.youtube.com/watch?v=3ujBjUriUjI   ;jim reeves
;ALCC=http://www.youtube.com/watch?v=WR59yE0w2P8   ;Solidao
;ALCC=http://www.youtube.com/watch?v=zlfKdbWwruY   ;fmt=22 Matt
;ALCC=http://www.youtube.com/watch?v=Zd8f9Zqap6U   ;US elect
;ALCC=http://www.youtube.com/watch?v=wUPcimeiqLE   ;fmt=22 big buck bunny 720p
;ALCC=http://www.youtube.com/watch?v=kRTZoHTK608   ;Yao Lee
;ALCC=http://www.youtube.com/watch?v=n9l3bX-xWxQ   ;SULLE SALAISUUDEN KERTOA MÄ VOISIN
;ALCC=http://www.youtube.com/watch?v=SH6wgK-A6Q8   ;Molbavello Dhou Goa India
;ALCC=http://www.youtube.com/watch?v=QA7euN0KgWk   ;Lee Hsiang Lan / Li Xiang Lan / Shirley Yamaguchi / Yoshiko Otaka
;ALCC=http://www.youtube.com/watch?v=IHzIItZKmD8   ;Ye Lai Xiang
;ALCC=http://www.youtube.com/watch?v=qicARYcTe6w    ;hd=1 / fmt=22  earth
;ALCC=http://www.youtube.com/watch?v=ep7W89I_V_g
;---------------------------------------------------------------------------------

Gui,2:Add,Edit,c%editcolor%  x100   y10     h20  w400    vEditYoutube ,%ALCC%        ;EDIT YOUTUBE
Gui,2:add,button,    x100   y10   w0   default   gDOWNLOAD1,

Gui,2:Add,Edit,c%editcolor%    x100   y40     h20  w510   vURL2      Readonly    ,
Gui,2:Add,Edit,c%editcolor%    x100   y70     h20  w510   vAL1       Readonly    ,
Gui,2:Add,Edit,c%editcolor%    x100   y100    h20  w510   vNAME1     Readonly    ,
Gui,2:Add,Edit,c%editcolor%    x100   y130    h20  w510   vPROCESS11 Readonly    ,

Gui,2:Add,Progress,            x100   y160    h20  w510   vPRBAR cFF7200

Gui,2:Add,Edit,c%editcolor%    x100   y190    h20  w50    vText22 Readonly    ,   ;procent
Gui,2:Add,Edit,c%editcolor%    x160   y190    h20  w450   vText23 Readonly    ,   ;size  / name

Gui,2:add,text,  c%textcolor%          x395    y270        ,FMT=
Gui,2:Add,Edit,  c%editcolor%          x430    y270    h20  w40   vFMTX Readonly    ,

;--------------------------------------------------------------


;--- for test ---
;AAX1=Grace Chang
;AAAA=Bengawan solo

Gui,2:Add,Edit,c%editcolor%    x100   y230    h20  w280   vSRCH1       ,%AAX1%   ;for test
Gui,2:Add,Button,              x400   y230    h20  w100   gYOUTUBE     ,>YOUTUBE
Gui,2:Add,Button,              x510   y230    h20  w100   gFolder1     ,RECORDED
ifexist,%MP3extract%
  Gui,2:Add,Button,            x510   y260    h20  w100   gEXTRACTMP3  ,EXTRACTMP3
Gui,2:Add,Button,              x510   y290    h20  w100   gReload1     ,Reload

Gui,2:add,text,  c%textcolor%  x10    y300            ,When download finished

Gui,2:Add,edit,cBlack          x10    y660    h24  w200  gSEARCH2   vSRCH2    ,%AAAA%


;------------------------------------------------------------------------------------
  IniRead,VID1,  %YOUTUBEMP4INI%  ,Startvideo       , KEY1
  IniRead,BEEP1, %YOUTUBEMP4INI%  ,Beep             , KEY1

if VID1=0
  Gui,2:Add,CheckBox,c%textcolor%         x200    y300    vVID1 gVID1A  ,Run Video
else
  Gui,2:Add,CheckBox,c%textcolor% checked x200    y300    vVID1 gVID1A  ,Run Video

if BEEP1=0
  Gui,2:Add,CheckBox,c%textcolor%         x330    y300    vBEEP1 gBEEP1A  ,Beep
else
  Gui,2:Add,CheckBox,c%textcolor% checked x330    y300    vBEEP1 gBEEP1A  ,Beep
;------------------------------------------------------------------------------------



F21=%A_scriptdir%\youtubelog.txt
T1 :=100
T2 :=420
T3 :=50
T4 :=0
T5 :=0
T6 :=50
T1A:=T1
T2A:=T1+T2
T3A:=T1+T2+T3
T4A:=T1+T2+T3+T4
T5A:=T1+T2+T3+T4+T5
T6A:=T1+T2+T3+T4+T5+T6

LSW:=T1+T2+T3+T4+T5+T6+20
GSW:=LSW+30
Gui,2:Font, S12 CDefault, Verdana
Gui,2:Add, ListView, x10 y330 grid r14 w%LSW% +hscroll  altsubmit vA1 gA2,Member| < Start > Youtube|DNL|URL2|DATE|FMT
Gui,2:Font, CDefault, FixedSys

LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
LV_ModifyCol(5,T5)
LV_ModifyCol(6,T6)

gosub,filllist1
Gui,2:add,text,  c%textcolor%          x10    y630     vLINES1   ,Links= %I%

gosub,DDDD
settimer,DDDD,1300

YTB1=YOUTUBE
SIZEVERTICAL:=(690)
Gui,2:Show,            x0   y0     h%SIZEVERTICAL%  w%GSW% ,%YTB1% [100]
return
;-------------------------------------------------------------------






;---  reads text-file ----
SEARCH2:
Gui,2:submit,nohide
LV_Delete()
NR=0
GuiControl,2:Text,Lines1,

loop,read,%F21%
  {
  LR=%A_loopreadline%
  if LR=
     continue
  stringsplit,C,LR,`;,

   CX=%C1%%C2%                     ;search in column A and B
   if SRCH2=
         CX=
   ifinstring,CX,%SRCH2%
       {
       NR++
       LV_Add("",C1,C2,C3,C4,C5,C6)
       }
  }

GuiControl,2:Text,Lines1,%NR%
return
;------  END SEARCH --------------------









EXTRACTMP3:
Gui,2: Show,minimize       ;minimize screen
run,%MP3extract%
ifexist,%rec%
    run,%rec%
return



VID1A:
Gui,2:submit,nohide
if VID1=0
  IniWrite,0, %YOUTUBEMP4INI%  ,Startvideo      , KEY1
else
  IniWrite,1, %YOUTUBEMP4INI%  ,Startvideo      , KEY1
return



BEEP1A:
Gui,2:submit,nohide
if BEEP1=0
  IniWrite,0, %YOUTUBEMP4INI%  ,BEEP  , KEY1
else
  IniWrite,1, %YOUTUBEMP4INI%  ,BEEP  , KEY1
return




MH11:
ifexist,%MP3extract%
    run,%MP3extract%
else
   goto,MP3CONVERTER
return



MH12:
run,http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
return



MH13:
run,http://www.dvdvideosoft.com
return
;------------------------------------------------------------------------


folder1:
run,%rec%
return

reload1:
reload
return


;-------------------------------------------------------------------
filllist1:
Gui,2:default
Gui,2:ListView,A1
I=0
LV_Delete()
  loop,read,%F21%
   {
   LR=%A_loopreadline%
   if LR=
      continue
   I++
   stringsplit,C,LR,`;
   SplitPath,C2, name9, dir9, ext9, name_no_ext9, drive9
   LV_Add("",C1,name9,C3,C4,C5,C6)
   C1=
   C2=
   C3=
   C4=
   C5=
   C6=
   }
LV_Modify(LV_GetCount(), "Vis")         ;goto last position
return



;------------------ LISTVIEW --------------------------------------
A2:
  Gui,2: Submit, NoHide
  Gui,2:ListView,A1

     RN:=LV_GetNext("C")  ;2  selected checked
     RF:=LV_GetNext("F")  ;2  selected focused
     GC:=LV_GetCount()    ;4  total

   if A_GuiEvent=Normal
     {
     if (RN="" OR RN=0)
         return
     C1=
     C2=
     C3=
     C4=
     C5=
     C6=
    MouseGetPos,x,y
        {
       if x<%T1A%
          {
          LV_GetText(C1,A_EventInfo,1)
          run,http://www.youtube.com/user/%C1%&view=videos
          return
          }

     if x<%T2A%
          {
          LV_GetText(C3,A_EventInfo,3)
          run,%C3%
          return
          }

     if x<%T3A%
          {
          LV_GetText(C3,A_EventInfo,3)
          GuiControl,2:Text,EditYoutube,%C3%
          GuiControl,2:Focus,EditYoutube
          send,{enter}
          return
          }
       }

     }
return

;--------------------------------------------------------------------------------










;=================  SETTIMER =====================================================
DDDD:
Gui,2:submit,nohide

URL11=%clipboard%
stringmid,URL11,URL11,1,60

if URL11 contains watch?v=
  goto,start2

stringmid,URL1aa,URL11,1,25
if URL1aa=http://www.youtube.com/v/
   {
   stringright,STRRR,URL11,11
   URL11=http://www.youtube.com/watch?v=%STRRR%
   goto,start2
   }

return
;---------------------------





START2:
Gui,2:Show,            x0   y0     h%SIZEVERTICAL%  w%GSW% ,
GuiControl,2:Text,EditYoutube,%URL11%
clipboard=
settimer,DDDD,off
gosub,DOWNLOAD1
edityoutube=
URL2=
settimer,DDDD,ON
return
;====================================================================================






YOUTUBE:
Gui,2: Show,minimize
GuiControlGet, SRCH1
   stringreplace,SRCH1,SRCH1,%S%,`%20,all
run,http://www.youtube.com/results?search_query=%SRCH1%&search=Search
return
;====================================================================================






;============================== YOUTUBE ==================================
;------------------------------ GETTITLE and 2nd-URL ----------------------

DOWNLOAD1:
Gui,2:submit,nohide

;'VIDEO_ID': 'DJZv_U0zGGI',
;'VIDEO_TITLE': 'Jim Reeves - Ek Verlang Na Jou',
;'SWF_ARGS': .........................
;"length_seconds": "123",
;"rv.1.author": "draadnagels",
;"plid": "AAR2k1KNnhEYePbl",
;"t": "vjVQa1PpcFNEAdLJHNU1FrARRUcdpr0IWIWE25eufN0%3D",
;'IS_WIDESCREEN': false,
;'IS_HD_AVAILABLE': false,
;'EMBED_URL': 'http://www.youtube.com/v/DJZv_U0zGGI&hl=en&fs=1',
;'VIDEO_USERNAME': 'draadnagels',




Guicontrolget,EditYoutube,2:
if EditYoutube contains youtube.com/watch?v=
   URL1=%EditYoutube%

if URL1=
   return
if URL1 not contains youtube.com/watch?v=
   return

GuiControl,2:Text,process11,
WinSetTitle,%YTB1% [100], ,%YTB1% [0]
GuiControl,2:,PRBAR,%nothing%
GuiControl,2:,Text22,%nothing%
GuiControl,2:,Text23,%nothing%


URL2=
TITLE=
new2=

F1  =%A_scriptdir%\YTB1.txt
ifexist,%F1%
   filedelete,%F1%

GuiControl,2:Text,PROCESS11,Start Download
UrlDownloadToFile,%URL1%,%F1%                        ;<<<<<<<<<<<<<<<<
GuiControl,2:Text,PROCESS11,Search for name

   Fileread,AA,%F1%
   stringreplace,AA,AA,%TEN%,%CF%,all
   filedelete,%F1%
   Fileappend,%AA%`r`n,%F1%


;'IS_HD_AVAILABLE': false,
;------- HQ --------------------------------
HD4=0
SEARCHFOR='IS_HD_AVAILABLE'
   Loop,Read,%F1%
      {
      LR=%A_LoopReadLine%
      if LR contains %SEARCHFOR%
             {
             Loop, Parse,LR ,`',`
                {
                Q%A_Index%  := A_LoopField
                if Q3<>
                  break
                }
             }
      if Q3<>
        break
      }

HD4=%Q3%
stringreplace,HD4,HD4,`:,%nothing%,all
stringreplace,HD4,HD4,`,,%nothing%,all
HD4=%HD4%
;msgbox,262144,MSG,HD4=%HD4%
if HD4=true
   HD4=1
if HD4=false
   HD4=0
;msgbox,262144,MSG,HD4=%HD4%




SEARCHFOR=
USERNAME2=
Q2=
;'VIDEO_USERNAME': 'draadnagels',
SEARCHFOR='VIDEO_USERNAME'
   Loop,Read,%F1%
      {
      LR=%A_LoopReadLine%
      if LR contains %SEARCHFOR%
             {
             Loop, Parse,LR ,`',`
                {
                Q%A_Index%  := A_LoopField
                if Q4<>
                  break
                }
             }
      if Q4<>
        break
      }
USERNAME2=%Q4%
;msgbox,262144,MSG,USERNAME2=%USERNAME2%


;'VIDEO_TITLE': 'Jim Reeves - Ek Verlang Na Jou',
SEARCHFOR=
SEARCHFOR='VIDEO_TITLE'
   Loop,Read,%F1%
      {
      LR=%A_LoopReadLine%
      if LR contains %SEARCHFOR%
             {
             stringmid,LR2,LR,17,200
             title=%LR2%
             stringreplace,TITLE,TITLE,`',%nothing%,all
             stringreplace,TITLE,TITLE,`,,%nothing%,all
              title=%title%
             ;msgbox,262144,MSG,TITLE1=%TITLE%


             stringreplace,TITLE,TITLE,`&amp`;quot`;,%S%,all         ;`"
             stringreplace,TITLE,TITLE,`&amp`;amp`;,%S%and%S%,all    ;`&
             stringreplace,TITLE,TITLE,`',%nothing%,all
             stringreplace,TITLE,TITLE,`;,%nothing%,all

             ; ---- replace at least portuguese letters --
             stringreplace,TITLE,TITLE,&quot,%S%,all
             stringreplace,TITLE,TITLE,quot,%S%,all
             stringreplace,TITLE,TITLE,&amp,%S%,all
             stringreplace,TITLE,TITLE,ç,c,all
             stringreplace,TITLE,TITLE,é,e,all
             stringreplace,TITLE,TITLE,è,e,all
             stringreplace,TITLE,TITLE,ñ,n,all
             stringreplace,TITLE,TITLE,ã,a,all
             stringreplace,TITLE,TITLE,ç,c,all     ;ç
             stringreplace,TITLE,TITLE,ã,a,all     ;ã
             stringreplace,TITLE,TITLE,ö,oe,all    ;ö
             stringreplace,TITLE,TITLE,é,e,all     ;é
             stringreplace,TITLE,TITLE,Ã,a,all      ;à
             break
             }
      }
TITLE=%title%
;msgbox,262144,MSG,TITLE=%TITLE%





t=
video_id=
sk=
hl=
plid=

HSS=
HSS2=


;-------------- NEW ----------------------------------------
;'SWF_ARGS': .........................
;"rv.1.author": "draadnagels",    ;not needed now
;"plid": "AAR2k1KNnhEYePbl",
;"t": "vjVQa1PpcFNEAdLJHNU1FrARRUcdpr0IWIWE25eufN0%3D",
;"video_id": "DJZv_U0zGGI",


CONTEN='SWF_ARGS'
SEARCHFOR="t":,"plid":,"video_id":
   Loop,Read,%F1%
      {
      LR=%A_LoopReadLine%
      ifinstring,LR,%CONTEN%
             {
             Loop, Parse,LR ,`, ,`
                {
                H%A_Index%  := A_LoopField
                if H%A_Index% contains %searchfor%
                   T%A_Index%:=A_LoopField
                if T%A_Index%<>
                   HSS=%HSS%%A_LoopField%&
                if A_loopfield contains "t"
                   t=%A_LoopField%
                if A_loopfield contains "video_id"
                   video_id=%A_LoopField%
                if A_loopfield contains "plid"
                   plid=%A_LoopField%
                H%A_Index%=
                T%A_index%=
                }
             break
            }
       }

nothing=
stringreplace,plid,plid,"plid":%S%,%nothing%,all
stringreplace,video_id,video_id,"video_id":%S%,%nothing%,all
stringreplace,t,t,"t":%S%,%nothing%,all
stringreplace,t,t,`%3D,%nothing%,all
stringreplace,t,t,",%nothing%,all
stringreplace,plid,plid,",%nothing%,all
stringreplace,video_id,video_id,",%nothing%,all

HSS2=video_id=%video_id%&l=%plid%&t=%t%
URL2a=http://www.youtube.com/get_video?%HSS2%
URL2=http://www.youtube.com/get_video?%HSS2%
ADD1=



/*
;------------ try to search fmt=35 -------------
if HD4<>1
 {
 ;fmtx =22|35|18|6
 fmtx =35|18|6
 loop, parse, fmtx, |
        {
        HQFMT=
        FMTnew=
   HQFMT=&fmt=%A_LoopField%
        FMTnew=%A_LoopField%
   url = http://www.youtube.com/get_video?video_id=%video_id%&l=%plid%&t=%t%=%HQFMT%
        SIZE7:=HttpQueryInfo(URL,5)
        ;msgbox,%size7%
        if (size7="timeout" or size7=0 or size7=-1)
           continue
        else
           break
      }
 }
*/





;-------------------------------------------
; Low Quality FLV  -
; High Quality FLV - &fmt=35
; MP4              - &fmt=18
; High Quality MP4 - &fmt=22

   if HD4=1
      {
      URL2=%URL2%=&fmt=22
      ADD1=&fmt=22
      FMT1=22
      GuiControl,2:Text,FMTX,22
      }

 else
      {
      if FMTnew=
        {
        FMT1=18
        ADD1=&fmt=18
        URL2=%URL2a%=&fmt=18
        GuiControl,2:Text,FMTX,18
        }
      else
        {
        URL2=%URL2a%=&fmt=%fmtnew%
        ADD1=&fmt=%fmtnew%
        FMT1=%fmtnew%
        GuiControl,2:Text,FMTX,%fmtnew%
        }
      }


;--------------------------------------------


GuiControl,2:Text,URL2,%URL2%
; ---  in name should be removed all special characters
;msgbox,262144,MSG,%URL2%


gosub,removechr

SplitPath,F2, name7, dir7, ext7, name_no_ext7, drive7
;msgbox,262144,MSG,NAME7=%name7%
GuiControl,2:Text,AL1,%REC%\%F2%
GuiControl,2:Text,name1,%name7%


;-----------------------------------------------------------------------------------


;-------------------------- DOWNLOAD YOUTUBE VIDEO ---------------------------------
DOWNLOAD2:
if URL2=
   {
   msgbox,262208,TEST, YOUTUBE URL to download is missing
   WinSetTitle,%YTB1% [0], ,%YTB1% [100]
   settimer,DDDD,1000
   return
   }


;---------------------------------------------------------------------------------------
continue5:
SIZE3=
SIZE3:=HttpQueryInfo(URL2,5)                       ;<<< check size from new URL2 adress
if size3=timeout
    {
      {
      URL2=%URL2a%
      ADD1=
      GuiControl,2:Text,FMTX,NX   ;not exist
      goto,continue5
      }

   ENDED1:
   AFC=0
   settimer,AAS4,OFF
   msgbox, 262208, Youtube download,Download not possible
   GuiControl,2:Text,EditYoutube,
   GuiControl,2:Text,AL1,
   GuiControl,2:Text,name1,
   GuiControl,2:Text,URL2,
   return
   }


AFC=0
settimer,AAS4,500
GuiControl,2:Text,PROCESS11,Download

GuiControl,2:+RANGE0-%SIZE3%,PRBAR                 ;CHANGE processbar
GuiControl,2:,Text23,SIZE=%SIZE3%


URL2b=%URL2%
;  Splashimage,,b w%WA% h50 x0 Y400 CWsilver m9 b fs10 zh0,Size=%size3%`n%URL2%
;----------------------------------------------------------------------------------------
URLDownloadToFile,%URL2%,%REC%\%F2%                ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;----------------------------------------------------------------------------------------
;  sleep,500
;  Splashimage, off


;------- write logfile -------------------------------------------------------------------
stringmid,ANOW7,A_NOW,1,12
 Loop, Parse,URL1 ,`&,`
        {
        H%A_Index%  := A_LoopField
        if H1<>
           URL1NEW=%H1%
        }
;-----------------------------------------------------------------------------------------

settimer,AAS4,off
AFC=0

SIZE3:=HttpQueryInfo(URL2,5)
if size3=-1
   {
   msgbox, 262180, Youtube download,Error size=-1`nTry again ?
   ifmsgbox,no
       return
   else
      {
      GuiControl,2:Text,FMTX,
      goto,download1
      }
   }


Filegetsize,size7,%REC%\%F2%
 if size7<500
   {
   GuiControl,2:Text,PROCESS11,NO SUCCESS try again
   GuiControl,2:,Text22,0 `%
   return
   }

else
   {
   GuiControl,2:Text,EditYoutube,
   GuiControl,2:Text,PROCESS11,Download finished
   GuiControl,2:,Text22,100 `%
   Fileappend,%USERNAME2%;%REC%\%F2%;%URL1NEW%%ADD1%;%URL2b%;%ANOW7%;%FMT1%`r`n,%F21%
   }

GuiControl,2:,PRBAR, %SIZE3%
;GuiControl,2:,Text22,100 `%  %name1%    SIZE=%SIZE3%
GuiControl,2:,Text23,%name7%
WinSetTitle,%YTB1% [%RES2%], ,%YTB1% [100]

  GuiControl,2:Text,AL1,
  GuiControl,2:Text,name1,
  GuiControl,2:Text,URL2,

gosub,filllist1
GuiControl,2:Text,LINES1,Links= %I%

IniRead, VID1 , %YOUTUBEMP4INI% ,Startvideo       , KEY1
IniRead,BEEP1, %YOUTUBEMP4INI%  ,Beep             , KEY1
if BEEP1=1
   SoundBeep,400,150


  ;---------- should Start video  (?) -------------------
  if VID1=0
     return
  else
   {
   ifexist,%REC%\%F2%
       run,%REC%\%F2%            ;run video when download finished
   return
   }

return
;--------------------------------------------------------------------------








;---------- GOSUB remove special characters from video name ----------------------
REMOVECHR:
autotrim,off
new2=

Loop,Parse,TITLE
         {
         A:=(Asc(A_LoopField))
         B:=chr(a)
         if (B="_" OR B=" " OR B="-")     ;allow _space   autotrim,off
         Goto,SKIP8
         if ((a<48 or a>57) AND A<65 OR A>90 AND A<97 OR A>122)
         continue
         SKIP8:
         new2=%new2%%b%
         }

    autotrim,on
    stringmid,ANOW1,A_NOW,1,12    ;if not readable chinese...
    anow1=%anow1%
    new2=%new2%
    if new2=
       {
          if fmtnew=35
            new3=_%ANOW1%.flv
          else
            new3=_%ANOW1%.mp4
       F2=%new3%
       return
       }


  if fmtnew=35
     new3=%new2%.flv
  else
    new3=%new2%.mp4
  F2=%new3%
  ifexist,%REC%\%F2%
      F2=_%ANOW1%_%F2%
return
;===========================================================




;================= GOSUBS ==================================
AAS4:

  Filegetsize,size1,%REC%\%F2%
  if AFC=0
     {
     if size1>500
        {
        AFC=1
        sleep,2000
        Gui,2: Show,minimize       ;minimize screen
        }
     }
  RES1:=Round((100*SIZE1)/SIZE3)
  GuiControl,2:,PRBAR, %SIZE1%
  ;GuiControl,2:,Text22,%RES1% `%      SIZE=%SIZE3%
  GuiControl,2:,Text22,%RES1% `%

     Guicontrolget,text3                                     ;<< 1-99
     WinSetTitle,%YTB1% [%RES2%], ,%YTB1% [%RES1%]
     RES2=%RES1%
     Text4=%Res2%
     GuiControl,2:Text,TEXT3,%text4%

return
;================ END AAS4 =================================







;================= DOWNLOAD http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe ===================
MP3CONVERTER:
{
   text31=
   (
   If you want convert downloaded video to MP3
   needs FreeVideoToMp3Converter.exe

   Download

   from
   http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
   Want you download this program ?
   )
msgbox, 262180, Start URL,%text31%
ifmsgbox,NO
   exitapp
else
   {
   run,http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
   exitapp
   }
}
return
;============================================================================





2Guiclose:
Gui,2:submit,nohide
;ifexist,%F1%
;   filedelete,%F1%
exitapp



;esc::exitapp





;-------------------------- FUNCTION GETSIZE before download -------------------------
;http://www.autohotkey.com/forum/topic10510.html
; Olfen PhiLho
;SIZE:=HttpQueryInfo(URL, 5)
;msgbox,262144,MESSAGE,SIZE = %SIZE% Byte



/*
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HttpQueryInfo ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
QueryInfoFlag:

HTTP_QUERY_RAW_HEADERS = 21
Receives all the headers returned by the server.
Each header is terminated by "\0". An additional "\0" terminates the list of headers.

HTTP_QUERY_CONTENT_LENGTH = 5
Retrieves the size of the resource, in bytes.

HTTP_QUERY_CONTENT_TYPE = 1
Receives the content type of the resource (such as text/html).

Find more at: http://msdn.microsoft.com/library/en-us/wininet/wininet/query_info_flags.asp

Proxy Settings:

INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS


; Examples:
; url1 = http://www.autohotkey.com
; url2 = http://www.autohotkey.com/download/AutoHotkeyInstall.exe
; MsgBox % HttpQueryInfo(url1)
; MsgBox % HttpQueryInfo(url2, 5)
; MsgBox % HttpQueryInfo(url2, 1)

USAGE=
Example for size:

#Include dlfilesize.ahk
;------ Jim reeves Mexican Joe ----
url=http://www.youtube.com/watch?v=YSx_kgXQJDg
SIZE:=HttpQueryInfo(URL, 5)
MsgBox,64,Info,Dateigröße = %SIZE% Byte

*/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


HttpQueryInfo(URL, QueryInfoFlag=21, Proxy="", ProxyBypass="") {
hModule := DllCall("LoadLibrary", "str", "wininet.dll")

If (Proxy != "")
AccessType=3
Else
AccessType=1

io_hInternet := DllCall("wininet\InternetOpenA"
, "str", "" ;lpszAgent
, "uint", AccessType
, "str", Proxy
, "str", ProxyBypass
, "uint", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}

iou_hInternet := DllCall("wininet\InternetOpenUrlA"
, "uint", io_hInternet
, "str", url
, "str", "" ;lpszHeaders
, "uint", 0 ;dwHeadersLength
, "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or iou_hInternet = 0) {
DllCall("FreeLibrary", "uint", hModule)
return, -1
}

VarSetCapacity(buffer, 1024, 0)
VarSetCapacity(buffer_len, 4, 0)

Loop, 5
{
  hqi := DllCall("wininet\HttpQueryInfoA"
  , "uint", iou_hInternet
  , "uint", QueryInfoFlag ;dwInfoLevel
  , "uint", &buffer
  , "uint", &buffer_len
  , "uint", 0) ;lpdwIndex
  If (hqi = 1) {
    hqi=success
    break
  }
}

IfNotEqual, hqi, success, SetEnv, res, timeout

If (hqi = "success") {
p := &buffer
Loop
{
  l := DllCall("lstrlen", "UInt", p)
  VarSetCapacity(tmp_var, l+1, 0)
  DllCall("lstrcpy", "Str", tmp_var, "UInt", p)
  p += l + 1
  res := res  . "`n" . tmp_var
  If (*p = 0)
  Break
}
StringTrimLeft, res, res, 1
}

DllCall("wininet\InternetCloseHandle",  "uint", iou_hInternet)
DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
DllCall("FreeLibrary", "uint", hModule)

return, res
}
;------------------------------------------------------------------
;============================ END =================================







;=========================== remarks ==============================
/*
; http://www.youtube.com/v/WR59yE0w2P8
; http://www.splicd.com/   (?)
; hd=1

; Low Quality FLV  - http://www.youtube.com/watch?v=Z840KrgBrPc&
; High Quality FLV - http://www.youtube.com/watch?v=Z840KrgBrPc&fmt=35   (?)
; MP4              - http://www.youtube.com/watch?v=Z840KrgBrPc&fmt=18
; High Quality MP4 - http://www.youtube.com/watch?v=Z840KrgBrPc&fmt=22
; start at         - http://www.youtube.com/watch?v=Z840KrgBrPc&fmt=22#t=1m02s

Standard (fmt=0 ?) > MP3, ~64 kbps, 22.05 KHz, mono (1 channel)
fmt=5 > MP3, ~64 kbps, 22.05 KHz, mono (1 channel) (little difference in video bitrate)
fmt=6 > MP3, ~66 kbps, 44.1 KHz, mono (1 channel)
fmt=18 > AAC, ~126 kbps, 44.1 KHz, stereo (2 channels)
fmt=22 > AAC, ~248 kbps, 44.1 KHz, stereo (2 channels) (only if uploaded video have 720p)
fmt=34 > AAC, ~68 kbps, 22.05 KHz, stereo (2 channels)
fmt=35 > AAC, ~112 kbps, 44.1 KHz, stereo (2 channels)
fmt=13 and
fmt=17 > only on mobile devices (3GP with AMR or AAC audio)


fmt=0  -> flv:  320x240 (flv1) / mp3 1.0 22KHz (same as fmt=5)
fmt=5  -> flv:  320x240 (flv1) / mp3 1.0 22KHz
fmt=6  -> flv:  480x360 (flv1) / mp3 1.0 44KHz (no more ...)
fmt=13 -> 3gp:  176x144 (mpg4) / ??? 2.0  8KHz
fmt=17 -> 3gp:  176x144 (mpg4) / ??? 1.0 22KHz
fmt=18 -> mp4:  480x360 (H264) / AAC 2.0 44KHz
fmt=22 -> mp4: 1280x720 (H264) / AAC 2.0 44KHz
fmt=34 -> flv:  320x240 (flv?) / ??? 2.0 44KHz (default)
fmt=35 -> flv:  640x380 (flv?) / ??? 2.0 44KHz
*/



/*
.............how to use ................................................
       start this script and youtube
       copy video link with rightclick or CTRL+c

       download starts, downloads ---namexy.flv-- or -- namexy.mp4 --
       when download finished possibility to convert video to MP3
       creates a logfile start member/youtube or download again
........................................................................


http://www.autohotkey.net/~garry/20081122_YOUTUBE_MP4.png


size example=
-----------------------------------------------
http://www.youtube.com/watch?v=qicARYcTe6w&hd=1

-720p HD Test 2: Big Buck Bunny
http://www.youtube.com/watch?v=wUPcimeiqLE&fmt=22   166-MB  mp4
http://www.youtube.com/watch?v=wUPcimeiqLE&fmt=18    42-MB  mp4
http://www.youtube.com/watch?v=wUPcimeiqLE           24-MB  flv
------------------------------------------------
var isHDAvailable = true;


........................ http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm
........................ http://www.dvdvideosoft.com/free-dvd-video-software.htm


.............. Free Video to MP3 Converter ...........................................................
http://www.dvdvideosoft.com/download/FreeVideoToMp3Converter.exe
http://www.dvdvideosoft.com/products/dvd/Free-Video-to-MP3-Converter.htm
Use Free Video to MP3 Converter to extract audio from video files
(*.avi, *mpg, *.mpg, *.mp4, *.m4v, *.mpeg, *.dvr-ms, *.wmv, *.asf, *.mov, *.qt, *.3gp, *.3g2 and *.flv)
 and save it as MP3

There are 3 pre-configured presets:
- High Quality (MP3, 256kbps, 48000Hz, STEREO);
- Standard Quality (MP3, 128kbps, 44100Hz, STEREO);
- Economy Quality (MP3, 96kbps, 22050Hz, STEREO).

and TRIM video
........................................................................................................
*/


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 1:22 pm 
Offline

Joined: April 25th, 2007, 10:13 pm
Posts: 29
sorry, forgot to sign in.

I also hope this topic become a stickie.

by the way, Skan in this topic implemented a short and sweet ATOU (Ansi to Unicode) and UTOA function: ( http://www.autohotkey.com/forum/topic38346.html )

Code:
ATOU( ByRef Unicode, Ansi ) { ; Ansi to Unicode
 VarSetCapacity( Unicode, (Len:=StrLen(Ansi))*2+1, 0 )
 Return DllCall( "MultiByteToWideChar", Int,0,Int,0,Str,Ansi,Int,Len, Str,Unicode, Int,Len )

UTOA( pUnicode )  {           ; Unicode to Ansi
  VarSetCapacity( Ansi,(nSz:=DllCall( "lstrlenW", UInt,pUnicode )+1) )
  DllCall( "WideCharToMultiByte", Int,0, Int,0, UInt,pUnicode, Int,nSz
                                , Str,Ansi, Int,nSz+1, Int,0, Int,0 )
}


Am I on the right track to think that I could use this on the song title (ATOU), what about the rest of the dllcall?

anxiously waiting...

:oops:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 2:07 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
UTOA won't work properly with UTF-8 and/or Double-Byte CharacterSet like Chinese, likely to crash AHK or truncate the string due to too short buffer. I suppose SKAN had no experience with DBCS. Anyway, you don't need these convert functions UTOA/ATOU with AutoHotkeyU, just use Unicode directly.

Hmm, ATOU also seems to be problematic as it didn't take into account the terminating NULL, it only specified Len.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 2:49 pm 
Offline

Joined: April 25th, 2007, 10:13 pm
Posts: 29
Sean wrote:
UTOA won't work properly with UTF-8 and/or Double-Byte CharacterSet like Chinese, likely to crash AHK or truncate the string due to too short buffer. ... Anyway, you don't need these convert functions UTOA/ATOU with AutoHotkeyU, just use Unicode directly.



You are right, what was I thinking. I suppose if we had a working ATOU/UTOA function, then we can use the original AutoHotkey to save the song title in chinese.
:oops:

However, I am still left with scratching my head on making garry's script work on AutohotkeyU. I was hoping for some magic powder/potion that I could use to make it work. :?:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 3:23 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
mosaic wrote:
I suppose if we had a working ATOU/UTOA function, then we can use the original AutoHotkey to save the song title in chinese.
Are you on a Chinese code page, compatible with the song title? Then, there exist numerous functions to use, for example, COM_Ansi4Unicode/COM_Unicode4Ansi in (original) COM.ahk. But, it's pointless to use those now as AutoHotkeyU is available.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 9:24 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
I've uploaded a new build based on AutoHotkey_L. Some features are disabled in this time, though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 9:48 am 
Offline

Joined: December 17th, 2007, 6:39 pm
Posts: 235
Location: Galati, Romania
But how about AutohotkeySC.bin? We need to compile scripts...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 9:57 am 
Offline

Joined: March 23rd, 2006, 2:20 pm
Posts: 128
YES, we all need to compile scripts...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 10:08 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
Petru wrote:
But how about AutohotkeySC.bin? We need to compile scripts...

I agree some people need that, though it is not a true *compiler* (doesn't convert the scripts into native codes and save it). I don't need it personally, and I suppose to make it stable first (so far not so many people tested it). There will be an AutohotkeySC.bin for Unicode definitely, but I don't like to release a buggy one. Since the best reason to use it is we can share the executables with our friends IMHO.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 2:53 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
jackieku wrote:
I've uploaded a new build based on AutoHotkey_L.
Great news! BTW, it gives Unsupported static initializer error. Otherwise, so far so good.
Code:
Static var:="test"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 5:56 pm 
Hi,
Delighted to see that you are beavering away on Autohotkey for Linux (the only thing that stops me ditching Windoze for Ubuntu 9.10).
Using the link provided by tinku99 on 18th July I downloaded the "executable": ahkx.tar.gz, so I have a directory "ahkx.tar.gz" in /tmp which contains files such as ahkmx.exe, ahkmx.c, install and suddirectories /debian and /xdotool. Unfortunately, as a newbie, I don't know what to do next!

In any case I guess things have moved on a lot since July, and my question is simply to ask if there is a more recent version that I could download, and if so what exactly I have to type in the terminal to get it up and running.

I realise this is a boring question for you developers, but if I can manage to get the thing working - even in its' incomplete stage - then anyone can! And I'd be pleased to explain what to do, in layperson terms, to other newbies who are interested.

Thanks, and the best of luck with this project. Kaspin


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 7:52 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
i think you mean http://www.autohotkey.com/forum/viewtop ... highlight=
this thread is autohotkey_l the l is for Lexikos who made this fork

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 8:24 pm 
No, he means tinku99's port: ahklinux

http://github.com/tinku99/ahkx

HTH


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 10:00 pm 
Online
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
Hi, Transform HTML is bugged. Here's a fix:
Code:
   case TRANS_CMD_HTML:
   {
      // These are the encoding-neutral translations for ASC 128 through 255 as shown by Dreamweaver.
      // It's possible that using just the &#number convention (e.g. &#128 through ÿ) would be
      // more appropriate for some users, but that mode can be added in the future if it is ever
      // needed (by passing a mode setting for aValue2):
      // €????????????????¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾?
      // ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüý?
      static const LPTSTR sHtml[128] = { // v1.0.40.02: Removed leading '&' and trailing ';' to reduce code size.
           _T("euro"), _T("#129"), _T("sbquo"), _T("fnof"), _T("bdquo"), _T("hellip"), _T("dagger"), _T("Dagger")
         , _T("circ"), _T("permil"), _T("Scaron"), _T("lsaquo"), _T("OElig"), _T("#141"), _T("#381"), _T("#143")
         , _T("#144"), _T("lsquo"), _T("rsquo"), _T("ldquo"), _T("rdquo"), _T("bull"), _T("ndash"), _T("mdash")
         , _T("tilde"), _T("trade"), _T("scaron"), _T("rsaquo"), _T("oelig"), _T("#157"), _T("#382"), _T("Yuml")
         , _T("nbsp"), _T("iexcl"), _T("cent"), _T("pound"), _T("curren"), _T("yen"), _T("brvbar"), _T("sect")
         , _T("uml"), _T("copy"), _T("ordf"), _T("laquo"), _T("not"), _T("shy"), _T("reg"), _T("macr")
         , _T("deg"), _T("plusmn"), _T("sup2"), _T("sup3"), _T("acute"), _T("micro"), _T("para"), _T("middot")
         , _T("cedil"), _T("sup1"), _T("ordm"), _T("raquo"), _T("frac14"), _T("frac12"), _T("frac34"), _T("iquest")
         , _T("Agrave"), _T("Aacute"), _T("Acirc"), _T("Atilde"), _T("Auml"), _T("Aring"), _T("AElig"), _T("Ccedil")
         , _T("Egrave"), _T("Eacute"), _T("Ecirc"), _T("Euml"), _T("Igrave"), _T("Iacute"), _T("Icirc"), _T("Iuml")
         , _T("ETH"), _T("Ntilde"), _T("Ograve"), _T("Oacute"), _T("Ocirc"), _T("Otilde"), _T("Ouml"), _T("times")
         , _T("Oslash"), _T("Ugrave"), _T("Uacute"), _T("Ucirc"), _T("Uuml"), _T("Yacute"), _T("THORN"), _T("szlig")
         , _T("agrave"), _T("aacute"), _T("acirc"), _T("atilde"), _T("auml"), _T("aring"), _T("aelig"), _T("ccedil")
         , _T("egrave"), _T("eacute"), _T("ecirc"), _T("euml"), _T("igrave"), _T("iacute"), _T("icirc"), _T("iuml")
         , _T("eth"), _T("ntilde"), _T("ograve"), _T("oacute"), _T("ocirc"), _T("otilde"), _T("ouml"), _T("divide")
         , _T("oslash"), _T("ugrave"), _T("uacute"), _T("ucirc"), _T("uuml"), _T("yacute"), _T("thorn"), _T("yuml")
      };

      // Determine how long the result string will be so that the output variable can be expanded
      // to handle it:
      VarSizeType length;
      TCHAR *ucp;
      for (length = 0, ucp = (TCHAR *)aValue1; *ucp; ++ucp)
      {
         switch(*ucp)
         {
         case '"':  // &quot;
            length += 6;
            break;
         case '&': // &amp;
         case '\n': // <br>\n
            length += 5;
            break; // v1.0.45: Added missing break.  This had caused incorrect lengths inside some variables, which led to problems in places that relied on the accuracy of the internal lengths.
         case '<': // &lt;
         case '>': // &gt;
            length += 4;
            break; // v1.0.45: Added missing break.
         default:
            if (*ucp > 127)
               length += (VarSizeType)_tcslen(sHtml[*ucp - 128]) + 2; // +2 for the leading '&' and the trailing ';'.
            else
               ++length;
         }
      }

      // Set up the var, enlarging it if necessary.  If the output_var is of type VAR_CLIPBOARD,
      // this call will set up the clipboard for writing:
      if (output_var.Assign(NULL, length) != OK)
         return FAIL;  // It already displayed the error.
      LPTSTR contents = output_var.Contents();  // For performance and tracking.

      // Translate the text to HTML:
      for (ucp = (TCHAR *)aValue1; *ucp; ++ucp)
      {
         switch(*ucp)
         {
         case '"':  // &quot;
            _tcscpy(contents, _T("&quot;"));
            contents += 6;
            break;
         case '&': // &amp;
            _tcscpy(contents, _T("&amp;"));
            contents += 5;
            break;
         case '\n': // <br>\n
            _tcscpy(contents, _T("<br>\n"));
            contents += 5;
            break;
         case '<': // &lt;
            _tcscpy(contents, _T("&lt;"));
            contents += 4;
            break;
         case '>': // &gt;
            _tcscpy(contents, _T("&gt;"));
            contents += 4;
            break;
         default:
            if ((*ucp > 127) && (*ucp < 256))
            {
               *contents++ = '&'; // v1.0.40.02
               _tcscpy(contents, sHtml[*ucp - 128]);
               contents += _tcslen(contents); // Added as a fix in v1.0.41 (broken in v1.0.40.02).
               *contents++ = ';'; // v1.0.40.02
            }
            else
               *contents++ = *ucp;
         }
      }
      *contents = '\0';  // Terminate the string.
      return output_var.Close(); // Must be called after Assign(NULL, ...) or when Contents() has been altered because it updates the variable's attributes and properly handles VAR_CLIPBOARD.
   }

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 10:49 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
All of my scripts using RegEx were crashed.
Code:
MsgBox % RegExMatch("CF_TEXT CF_BITMAP CF_METAFILEPICT CF_SYLK CF_DIF CF_TIFF CF_OEMTEXT CF_DIB CF_PALETTE CF_PENDATA CF_RIFF CF_WAVE CF_UNICODETEXT CF_ENHMETAFILE CF_HDROP CF_LOCALE CF_DIBV5", "(?:\w+\s+){2}(?<FORMAT>\w+\b)", CF_) "|" CF_FORMAT


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: IsNull, Miguel and 33 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group