Jump to content

torels

Active Members
  • Posts

    666
  • Joined

  • Last visited

1 Follower

About torels

  • Birthday 05/10/1993

Profile Information

  • Member Title
    I Hacked 127.0.0.1! :D
  • Location
    Rome
  • WWW
    http://torels.altervista.org

Recent Profile Visitors

1,293 profile views

torels's Achievements

Universalist

Universalist (7/7)

6

Reputation

  1. I actually didn't test it on iTunes 10 anyway I stopped following my AutoIt projects as I used to do some time ago, I'm quite busy atm so I preferred shifting my attention on other things, hoping I will get more time to continue developing my projects and ideas
  2. it is indeed!
  3. Hi There! I just wrote a brainfuck interpreter 'cause I had nothing to do XD here's the code ;brainfuck interpreter Global $input, $Array[1] $pos = 0 $current=0 $HelloWorld = "++++++++++ [ >+++++++ >++++++++++ >+++ >+ <<<<- ] >++. >+. +++++++. . +++. >++. " & _ "<<+++++++++++++++. >. +++. ------. --------. >+. >." $CAT=",[.,]" _Run($HelloWorld) ConsoleWrite(@CRLF) _Run($CAT) ConsoleWrite(@CRLF) Func _Run($Code) For $i = 1 to StringLen($Code) $String=StringMid($Code, $i, 1) Switch $String Case ">" $current+=1 ReDim $Array[Ubound($Array)+1] Case "<" $current-=1 Case "+" $Array[$current]=$Array[$current]+1 Case "-" $Array[$current]=$Array[$current]-1 Case "." ConsoleWrite(Chr($Array[$current])) Case "," If $pos = 0 Then $input = InputBox("Char", "Type a String", "", "", -1, 120) ConsoleWrite(@CRLF) EndIf $pos += 1 $Char = StringMid($input, $pos, 1) $Array[$current]=Asc($Char) If $pos = StringLen($input) Then $pos = 0 Case "[" $loop = "" $ct = $i Do $ct += 1 $loop &= StringMid($Code, $ct, 1) Until StringRight($loop, 1)="]" $loop = StringLeft($loop, StringLen($loop) -1) While $Array[$current]>1 _Run($loop) WEnd EndSwitch Next EndFunc For more information on brainfuck go to http://esoteric.voxelperfect.net/wiki/Brainfuck
  4. @Juvigy & dmob: I now there are many methods. The point of my question was, as I said, that the script returing the value is User-Created after the script recieving the value is compiled. So I needed to keep it as simple as possible so to use any script without any particular changes. Thanks for the help anyway @PsaltyDS: Thanks for your help, I suppose it's the easiest way of doing it
  5. thanks for the example but I wanted to use return Script B is a user-created script (created after script A is compiled) And I wanted it to return values like if the function was in the script, so using Return. Also, script A has no GUI. I was also thinking of a function override (i think that's the word) so to create a "Return" Function acting like Return... but i don't think it's possible... any other suggestions ?
  6. Hi there I'm working on a project where I need to return a value to a script other form the script where the function returning the value is in, and the "child" script isn't included in the "parent" one. Is there any way to return values using Return ? since my english isn't wonderful, i'll make a simple example: Script A.au3 runs script B.au3, and I want a value to be returned from script B.au3 to script A.au3 thanks in advance
  7. I don't think so... anyway not in an automatic way, you should re-write entirely the code in C++ Anyway if you have an autoit code you want to use in a C++ program you can either use the AutoItX functions OR more simply compile the script as a command line exe and call it from your script
  8. it's something about waiting... try adding a sleep or something. I havn't got much time to work on the udf (or actually be active on the forums right now so for the moment try and work it out yourself regards
  9. 69 views and no reply ? hasn't anyone tried the code ?
  10. Hi there I wrote something similar to this some time ago. See here. But honestly I didn't like is very much because of its very low functionality and efficency. It took ages to get the ID3 tags from the files so to copy them It had no GUI because of lazyness and few experienceAnd so on...But the main problem was Point 1. Fortunately I Found a file named iTunesDB on the iPod and opening it I found out it contained all the info that I precedently retrieved reading ID3 tags (which took loads of time). So after some time spent on analysing the file and (unsuccesfully) searching the forums and the internet I managed to get the infos I needed and to put them in an array. And I wrote this script: #include <Array.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <file.au3> Dim $pos[5] = [0, 0, 0, 0, 0] Global $iTunesDBPath $checked = 1 Opt("TrayAutoPause", 0) $iTDB = _Get_iPods() $Gui = GUICreate("iPod Transfer - Home - torels_", 754, 338) $ListView1 = GUICtrlCreateListView("|Title|Artist|Path", 0, 0, 553, 313, Default, $LVS_EX_CHECKBOXES) _GUICtrlListView_RegisterSortCallBack($ListView1) $ChoseDir = GUICtrlCreateButton("...", 736, 104, 17, 18, 0) $Filename = GUICtrlCreateInput("", 560, 104, 169, 18) GUICtrlCreateLabel("Save To", 560, 88, 45, 15) $Search = GUICtrlCreateButton("Search", 568, 216, 169, 25, 0) $Transfer = GUICtrlCreateButton("Transfer!", 360, 178, 185, 33, 0) $Progress1 = GUICtrlCreateProgress(0, 318, 553, 17) $Progress2 = GUICtrlCreateProgress(558, 318, 754 - 558, 17) $Info = GUICtrlCreateButton("Info", 568, 248, 169, 25, 0) $Status = GUICtrlCreateLabel("Connected to " & DriveGetLabel(StringLeft($iTunesDBPath, 3)), 560, 24, 192, 57) $rArtist = GUICtrlCreateRadio("Artist", 568, 272) $rTitle = GUICtrlCreateRadio("Title", 568, 292) $rAll = GUICtrlCreateRadio("All", 680, 272) ControlHide($Gui, "", $rArtist) ControlHide($Gui, "", $rTitle) ControlHide($Gui, "", $rAll) ControlShow($Gui, "", $Transfer) GUISetState(@SW_SHOW, $Gui) _Fill($iTDB, $ListView1) GUICtrlSetPos($Transfer, 568, 178, 169, 25) ;GUICtrlSetPos($Progress1,0, 520, 553, 17) While 1 Switch GUIGetMsg($Gui) Case - 3 Exit Case $Search $Mode = "" If GUICtrlRead($rAll) = $GUI_CHECKED Then $Mode = "All" If GUICtrlRead($rTitle) = $GUI_CHECKED Then $Mode = "Title" If GUICtrlRead($rArtist) = $GUI_CHECKED Then $Mode = "Artist" If $Mode = "" Then $Mode = "All" $KeyWord = InputBox("Search", "Search Keywords. Blank for all!", "", "", -1, 200) If @error Then ContinueLoop $hSearch = _Search($KeyWord, $iTDB, $Mode) _Fill($hSearch, $ListView1) Case $ListView1 If GUICtrlGetState($ListView1) = 0 Then If $checked = 1 Then ;_Fill($iTDB, $ListView1, 0) $ct = _GUICtrlListView_GetItemCount($ListView1) For $i = 0 To $ct _GUICtrlListView_SetItemChecked($ListView1, $i, False) Next $checked = 0 Else $ct = _GUICtrlListView_GetItemCount($ListView1) For $i = 0 To $ct _GUICtrlListView_SetItemChecked($ListView1, $i, True) Next $checked = 1 EndIf Else _GUICtrlListView_BeginUpdate($ListView1) _GUICtrlListView_SortItems($ListView1, GUICtrlGetState($ListView1)) _GUICtrlListView_EndUpdate($ListView1) ;_ArraySort($iTDB, 0,0,0,GUICtrlGetState($ListView1)) ;_Fill($iTDB, $ListView1) EndIf Case $ChoseDir $hFile = FileSelectFolder("Save to...", @DesktopDir, 1 + 2) If @error Then ContinueLoop GUICtrlSetData($Filename, $hFile) Case $Transfer $path = GUICtrlRead($Filename) If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) If StringStripWS($path, 4) = "" Then MsgBox(64, "iPod Transfer", "Please select a Pah where to save the files you will transfer!") ContinueLoop EndIf If Not FileExists($path) Then $confirm = MsgBox(4 + 48, "iPod Tranfer", "The directory """ & $path & """ does not exist. Do you wish to create the directory now in order to Transfer the files from your iPod?") If $confirm = 7 Then MsgBox(64, "Information", "The file copy has been cancelled!") ContinueLoop EndIf EndIf $ct = _GUICtrlListView_GetItemCount($ListView1) - 1 If FileExists($path) Then For $i = 0 To $ct $From = _GUICtrlListView_GetItemText($ListView1, $i, 3) $Title = _GUICtrlListView_GetItemText($ListView1, $i, 1) $Artist = _GUICtrlListView_GetItemText($ListView1, $i, 2) If _GUICtrlListView_GetItemChecked($ListView1, $i) = $GUI_CHECKED Then FileCopy(StringLeft($iTunesDBPath, 2) & $From, $path & "\" & $Artist & "\" & $Title & " - " & $Artist & StringRight($From, 4), 8 + 1) GUICtrlSetData($Status, "Copying File """ & $Title & " - " & $Artist & """. File " & $i & " of " & $ct & "." & @CRLF & Floor($i * 100 / $ct) & "%") EndIf GUICtrlSetData($Progress1, $i * 100 / $ct) Next GUICtrlSetData($Progress1, 0) GUICtrlSetData($Status, "Connected to " & DriveGetLabel(StringLeft($iTunesDBPath, 3))) Else GUICtrlSetData($Status, $path & """ is not a valid path!""") Sleep(2000) GUICtrlSetData($Status, "Connected to " & DriveGetLabel(StringLeft($iTunesDBPath, 3))) EndIf Case $Info MsgBox(0, "iPod Transfer", "Powered and developed by torels_ under GNU GPL license." & _ @CRLF & "iPod Transfer v2. For Info and Support please visit http://torels.altervista.org") EndSwitch $np = GUIGetCursorInfo($Gui) If $pos[4] <> $np[4] Then $pos = GUIGetCursorInfo($Gui) Switch $pos[4] Case $Transfer GUICtrlSetPos($Transfer, 560, 178, 185, 33) GUICtrlSetPos($Search, 568, 216, 169, 25) GUICtrlSetPos($Info, 568, 248, 169, 25) ControlHide($Gui, "", $rArtist) ControlHide($Gui, "", $rTitle) ControlHide($Gui, "", $rAll) Case $Search GUICtrlSetPos($Transfer, 568, 178, 169, 25) GUICtrlSetPos($Search, 560, 216 - 7, 185, 33) GUICtrlSetPos($Info, 568, 248, 169, 25) ControlShow($Gui, "", $rArtist) ControlShow($Gui, "", $rTitle) ControlShow($Gui, "", $rAll) Case $Info GUICtrlSetPos($Transfer, 568, 178, 169, 25) GUICtrlSetPos($Search, 568, 216, 169, 25) GUICtrlSetPos($Info, 560, 248, 185, 33) ControlHide($Gui, "", $rArtist) ControlHide($Gui, "", $rTitle) ControlHide($Gui, "", $rAll) EndSwitch EndIf WEnd Func _Get_iPods() Local $ComboString $StartGui = GUICreate("iPod Transfer", 200, 80) $Combo = GUICtrlCreateCombo("Select Your iPod", 5, 5, 190) $OK = GUICtrlCreateButton("Select iPod", 100 - 190 / 2, 40, 190, 30) $List = DriveGetDrive("Removable") For $i = 1 To UBound($List) - 1 If DriveStatus($List[$i]) = "Ready" Then If FileExists($List[$i] & "\" & "iPod_Control\iTunes\iTunesDB") Then $ComboString &= StringUpper($List[$i]) & "\ - " & DriveGetLabel($List[$i]) & "|" EndIf Next GUISetState() GUICtrlSetData($Combo, $ComboString) While 1 Switch GUIGetMsg() Case - 3 Exit Case $OK If FileExists(StringLeft(GUICtrlRead($Combo), 3)) Then $iTunesDBPath = StringLeft(GUICtrlRead($Combo), 3) & "iPod_Control\iTunes\iTunesDB" GUIDelete($StartGui) $iTDB = _Read_iPod(_iTunesDB_Read($iTunesDBPath)) ExitLoop Else MsgBox(16, "Error", """" & GUICtrlRead($Combo) & """ is not a valid iPod Device!") EndIf EndSwitch WEnd Return $iTDB EndFunc ;==>_Get_iPods Func _Fill($iTDB, $LV, $sel = 1) _GUICtrlListView_BeginUpdate($LV) _GUICtrlListView_DeleteAllItems($LV) If $sel = 1 Then $sel = $GUI_CHECKED If $sel <> 1 Then $sel = $GUI_UNCHECKED $UBound = UBound($iTDB) - 1 For $i = 1 To $UBound GUICtrlCreateListViewItem("|" & $iTDB[$i][1] & "|" & $iTDB[$i][2] & "|" & $iTDB[$i][0], $LV) GUICtrlSetState(-1, $sel) GUICtrlSetData($Progress1, $i * 100 / $UBound) Next GUICtrlSendMsg($ListView1, 0x101E, 0, 20) GUICtrlSendMsg($ListView1, 0x101E, 1, 150) GUICtrlSendMsg($ListView1, 0x101E, 2, 200) GUICtrlSendMsg($ListView1, 0x101E, 3, 149) _GUICtrlListView_EndUpdate($LV) GUICtrlSetData($Progress1, 0) EndFunc ;==>_Fill Func _Search($KeyWord, $iTDB, $Mode = "Title", $ExactMatch = 0) Local $aRet[1][3] If StringStripWS($KeyWord, 8) = "" Or $KeyWord = "*" Then Return $iTDB Switch $Mode Case "Title" $Mode = 1 Case "Artist" $Mode = 2 Case "All" $Mode = 3 EndSwitch $Size = UBound($iTDB) - 1 ProgressOn("iPod Transfer v2", "Searching...") If $Mode < 3 Then ;Artist | Title For $i = 0 To UBound($iTDB) - 1 ProgressSet($i * 100 / $Size, $i & " Entries Searched") If $ExactMatch = 1 Then If $iTDB[$i][$Mode] = $KeyWord Then ReDim $aRet[UBound($aRet) + 1][3] $aRet[UBound($aRet) - 1][0] = $iTDB[$i][0] $aRet[UBound($aRet) - 1][1] = $iTDB[$i][1] $aRet[UBound($aRet) - 1][2] = $iTDB[$i][2] EndIf Else If StringInStr($iTDB[$i][$Mode], $KeyWord, 0) Then ReDim $aRet[UBound($aRet) + 1][3] $aRet[UBound($aRet) - 1][0] = $iTDB[$i][0] $aRet[UBound($aRet) - 1][1] = $iTDB[$i][1] $aRet[UBound($aRet) - 1][2] = $iTDB[$i][2] EndIf EndIf Next Else For $i = 0 To UBound($iTDB) - 1 ProgressSet($i * 100 / $Size, $i & " Entries Searched") If $ExactMatch = 1 Then If $iTDB[$i][1] = $KeyWord Or $iTDB[$i][2] = $KeyWord Then ReDim $aRet[UBound($aRet) + 1][3] $aRet[UBound($aRet) - 1][0] = $iTDB[$i][0] $aRet[UBound($aRet) - 1][1] = $iTDB[$i][1] $aRet[UBound($aRet) - 1][2] = $iTDB[$i][2] EndIf Else If StringInStr($iTDB[$i][1], $KeyWord) Or StringInStr($iTDB[$i][2], $KeyWord) Then ReDim $aRet[UBound($aRet) + 1][3] $aRet[UBound($aRet) - 1][0] = $iTDB[$i][0] $aRet[UBound($aRet) - 1][1] = $iTDB[$i][1] $aRet[UBound($aRet) - 1][2] = $iTDB[$i][2] EndIf EndIf Next EndIf ProgressOff() ;_ArrayDisplay($aRet) Return $aRet EndFunc ;==>_Search Func _Read_iPod($iTunesDB) Local $aData[1][3] $Curr_Title = $iTunesDB[2] $Curr_Artist = $iTunesDB[3] $Drive = StringLeft($iTunesDB[0], 2) ProgressOn("iPod Transfer", "Scanning Your iPod...") $s = UBound($iTunesDB) - 1 For $i = 2 To UBound($iTunesDB) - 1 ProgressSet($i * 100 / $s, $i & " Entries Read") $Plus = 1 If StringLeft($iTunesDB[$i], 1) = "\" Then $Size = UBound($aData) ReDim $aData[$Size + 1][3] $aData[$Size][0] = StringLeft($iTunesDB[$i], 32) $aData[$Size][1] = $Curr_Title $aData[$Size][2] = $Curr_Artist If StringLen($iTunesDB[$i]) > 32 Then $Plus = 0 If StringInStr($iTunesDB[$i + 1 + $Plus], "mhit") Then $Plus = 2 $Curr_Title = $iTunesDB[$i + 1 + $Plus] $Curr_Artist = $iTunesDB[$i + 2 + $Plus] EndIf Next $aData[0][0] = UBound($iTunesDB) - 1 ;files in iPod (Including Videos) ProgressOff() ;_ArrayDisplay($aData) Return $aData EndFunc ;==>_Read_iPod Func _iTunesDB_Read($iTunesDB) ;Tested on iPod 5.5G (iPod Video) $StopAt = 0 $Read = _RemoveNuls($iTunesDB) $label = DriveGetLabel(StringLeft($iTunesDB, 3)) $s = StringSplit($Read, "mhod", 1) ;subdivide every value of the DB (contained in a <mhod> XML tag) For $i = 0 To UBound($s) - 1 ;Throw away any extra rubbish chars $r = StringStripWS($s[$i], 1) If StringInStr($r, "iPod_Control") Then $r = StringReplace($r, ":", "\") $r = StringRight($r, StringLen($r) - 6) If $r = $label Then $StopAt = $i ExitLoop ;When Drive label is reached... Stop! EndIf $s[$i] = $r Next ReDim $s[$StopAt] $s[0] = $iTunesDB ;_ArrayDisplay($s) ; --> Debbugging Use Only Return $s EndFunc ;==>_iTunesDB_Read Func _RemoveNuls($inFile) $hFile = FileOpen($inFile, 0) $vRead = FileRead($hFile) FileClose($hFile) $vWrite = StringReplace($vRead, Chr(0x0), "") ;<- This! Return $vWrite EndFunc ;==>_RemoveNuls Func OnAutoItExit() _GUICtrlListView_UnRegisterSortCallBack($ListView1) EndFunc ;==>OnAutoItExitThanks to PsaltyDS and Trancexxx for the _RemoveNuls() function, which took quite a while to understand XD The main features include Searching, a Selective copy of the files, a GUI enlisting all the files on the iPod and an Artist and Title Subdivision of these files. It works perfectly with files added by iTunes, but doesn't with those added by floola This script has been tested on a 5.5G iPod (iPod Video) but it should work with other versions too. If someone wants to test it on other iPod versions too it would be great any suggestions and improvements are well accepted
  11. no, it's full of nulls in random positions Pff
  12. thanks PsaltyDS. This is what I was looking for... but what if i've go to work with a ~ 2MB file ? it takes ages to read a file of those dimensions is there any other method ? or shuold I stick to a script that opens the file in notepad and saves it with anoter name ? thanks alot for the help ps. I tried with some string replacements but with no positive results
  13. I also tried 16+32... with no result whatsoever is it possible for some char to terminate the file reading ? how am I supposed to work around the thing ?
  14. as I said... it only gives me the first 5 chars
  15. Hi there. I already made a search on UTF-16 on the forum and nothing important or useful came out my problem is that I have a file encoded in UTF-16 little endian and autoit just doesn't read it... it stops at the 5 char. Here is an example of the file: mhbd¼ Ê[ % f„`uAûÓ c¥-ÿ"@|š itGÇ "3F‹ &ÿÿ mhsd` J‰ mhlt\ S mhitH H A4M ôkµÂ - ˆm Ï € D¬ > ÛkµÂ ¶¦ü‹ ñi ÿÿ D,G 3 ®Rà ¶¦ü‹ ñi @ ø> À ¥ü‹ ñi - €€€€€€ mhod F " H i g h w a y B l u e s " mhod ž v M a r c S e a l e s , c o m p o s e r . N e w S t o r i e s . E r n i e W a t t s , s a x o p h o n e . mhod @ S p e a k i n ' O u t mhod 0 J a z z mhod D F i l e a u d i o A A C mhod h @ : i P o d _ C o n t r o l : M u s i c : F 2 4 : R X R U . m 4 a To read the file with autoit I needed to Open the file in notepad and "Save as..." and change the Encoding to ANSI in the Save As Dialog otherwise, both with FileRead() and With Fileopen() with the little endian flag and then fileread() what I get is just mhbd¼ can anyone help ? thanks in advance
×
×
  • Create New...