Lapone Posted February 4, 2007 Share Posted February 4, 2007 Hi all, I'm new in the forum. I need help convertind a command like this: nconvert -out bmp -resize 640 480 -o C:\result_%%.bmp mypic.jpg oÝ÷ Ú)í ¢+lÊ{ZÅ«¢+Ø(ÀÌØíáôMÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈí¹½¹ÙÉйáÅÕ½Ðì(ÀÌØíÁ¥ôMÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíµåÁ¥¹©ÁÅÕ½Ðì(ÀÌØíÍÐôQµÁ¥ÈµÀìÅÕ½ÐìÀäÈíÉÍձйµÀÅÕ½Ðì(ÀÌØíÉÌôÍѽÁ]¥Ñ µÀìÌäìÌäìµÀìÍѽÁ!¥¡Ð()ÉÕ¸ ÀÌØíáµÀìÌäìµ½ÕеÀµÉÍ¥éÅÕ½ÐìÌäìµÀìÀÌØíÉ̵ÀìÌäìÅÕ½Ðìµ¼µÀìÀÌØíÍÐÅÕ½ÐìÌäìµÀìÀÌØíÁ¥°ÅÕ½ÐìÅÕ½Ðì°M]}!%¤( Thanks in advance Link to comment Share on other sites More sharing options...
Developers Jos Posted February 4, 2007 Developers Share Posted February 4, 2007 RunWait(@ComSpec & ' /C "' $exe & '" -out bmp -resize "' & $res & '" -o "' & $dest & '" "' & $pic & '"', "", @SW_HIDE) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Lapone Posted February 4, 2007 Author Share Posted February 4, 2007 Thanks for your reply It gives me this error: RunWait(@ComSpec & ' /C "' $exe & '" -out bmp -resize "' & $res & '" -o "' & $dest & '" "' & $pic & '"', "", @SW_HIDE) RunWait(^ ERROR Error: Error in expression. Link to comment Share on other sites More sharing options...
BALA Posted February 4, 2007 Share Posted February 4, 2007 I think you forgot the extra "&" between ' /C "' and $exe [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
Lapone Posted February 4, 2007 Author Share Posted February 4, 2007 I think you forgot the extra "&" between ' /C "' and $exeAdded the extra "&" and no more error message.Unfortunately result image is not created Link to comment Share on other sites More sharing options...
Lapone Posted March 2, 2007 Author Share Posted March 2, 2007 Hi, it seems that I successfully handled my little script to randomize wallpaper in a BartPE CD expandcollapse popup#NoTrayIcon Dim $favDir = @ScriptDir & '\Wallpapers\' Dim $exe = @ScriptDir & "\nconvert.exe" Dim $dest = @TempDir & "\wall.bmp" $hFilesFolders = _FileListToArrayEx($favDir, '*.jpg; *.bmp; *.gif; *.png') If @error Then Exit $s_FileList = _ArrayToString($hFilesFolders, "*",1) $a_FileList = StringSplit($s_FileList, "*") $s_TempFile = _TempFile() _FileWriteFromArray($s_TempFile, $a_FileList) $count = _FileCountLines($s_TempFile) $sLine = FileReadLine($s_TempFile, 1) _removeLineInFile($s_TempFile, $sLine, 3, 1, 0, 0) $read = FileReadLine($s_TempFile, Random(1, $count, 0)) Filedelete ($s_TempFile) SetImage($favDir & $read) Func SetImage($pic) If Not FileExists($pic) Then Return -1 FileDelete($dest) RunWait($exe & ' -out bmp -resize "' & @DesktopWidth & '" "' & @DesktopHeight & '" -o "' & $dest & '" "' & $pic & '"', "", @SW_HIDE) Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop" Local $REG_LOGON= "HKEY_LOCAL_MACHINE\SOFTWARE\Reatogo\Logon\Shells\Explorer" RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 2) RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $pic) RegWrite($REG_LOGON, "Wallpaper", "REG_SZ", $pic) Sleep(250) DllCall("User32.dll", "int", "SystemParametersInfo", _ "int", 20, _ "int", 0, _ "string", $dest, _ "int", 0x01) Return 0 EndFunc My question is How can I modify this script to avoid the need of write to temp file? Regards Link to comment Share on other sites More sharing options...
MrCreatoR Posted March 2, 2007 Share Posted March 2, 2007 How can I modify this script to avoid the need of write to temp file? expandcollapse popup#NoTrayIcon Dim $favDir = @ScriptDir & '\Wallpapers\' Dim $exe = @ScriptDir & "\nconvert.exe" Dim $dest = @TempDir & "\wall.bmp" $hFilesFolders = _FileListToArrayEx($favDir, '*.jpg; *.bmp; *.gif; *.png') If @error Then Exit $s_FileList = _ArrayToString($hFilesFolders, "*",1) $a_FileList = StringSplit($s_FileList, "*") $count = $a_FileList[0] $sLine = $a_FileList[1] _ArrayDelete($a_FileList, $sLine) $read = $a_FileList[Random(1, $count, 0)] SetImage($favDir & $read) Func SetImage($pic) If Not FileExists($pic) Then Return -1 FileDelete($dest) RunWait($exe & ' -out bmp -resize "' & @DesktopWidth & '" "' & @DesktopHeight & '" -o "' & $dest & '" "' & $pic & '"', "", @SW_HIDE) Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop" Local $REG_LOGON= "HKEY_LOCAL_MACHINE\SOFTWARE\Reatogo\Logon\Shells\Explorer" RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 2) RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $pic) RegWrite($REG_LOGON, "Wallpaper", "REG_SZ", $pic) Sleep(250) DllCall("User32.dll", "int", "SystemParametersInfo", _ "int", 20, _ "int", 0, _ "string", $dest, _ "int", 0x01) Return 0 EndFunc I dont know the functions, but this i think will work... If tyou show here the rest of the functions, it will be much easyear to fix this. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 2, 2007 Moderators Share Posted March 2, 2007 No way for me to test this:$hFilesFolders = _FileListToArrayEx($favDir, '*.jpg; *.bmp; *.gif; *.png') If @error Then Exit $s_FileList = _ArrayToString($hFilesFolders, "*", 1);confused on why you would make it a string, then the next line make it an array again. $a_FileList = StringSplit($s_FileList, "*") $sHold = '' For $iCC = 1 To UBound($a_FileList) - 1 If StringInStr($a_FileList[$iCC], $sLine, 1) Then;Instead of _ReplaceStringInFile $sHold &= 3 & Chr(1) Else $sHold &= $a_FileList[$iCC] & Chr(1) EndIf Next $sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1));Re make an array _SetImage ($favDir & $sHold[Random(1, UBound($sHold) - 1, 1));random from 1 to max elements, no decimals Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Lapone Posted March 2, 2007 Author Share Posted March 2, 2007 Thanks MsCreatoR & SmOke_N for the reply. @MsCreatoR Works @SmOke_N If StringInStr($a_FileList[$iCC], $sLine, 1) Then If StringInStr($a_FileList[$iCC], ^ ERROR Error: Variable used without being declared. I'll check further Link to comment Share on other sites More sharing options...
Lapone Posted March 2, 2007 Author Share Posted March 2, 2007 @SmOke_N It's my fault. Both scripts work like a charm...Thanks :" Link to comment Share on other sites More sharing options...
Lapone Posted March 30, 2007 Author Share Posted March 30, 2007 Hi, I want to change the script for saving the pictures displayed into a SeenPic.txt. At Startup the script checks if SeenPic.txt exists and if it exists deletes the images already seen from the "total array". But something went wrong because the same images are shown many times... Any advice is really appreciated. expandcollapse popup#NoTrayIcon Dim $favDir = @ScriptDir & '\Wallpapers\' Dim $exe = @ScriptDir & "\nconvert.exe" Dim $dest = @TempDir & "\wall.bmp" $hFileRead = FileOpen(@ScriptDir & '\SeenPic.txt', 0) ;---------------------------------> $hFileWrite = FileOpen(@ScriptDir & '\SeenPic.txt', 1) ;---------------------------------> $hFilesFolders = _FileListToArrayEx($favDir, '*.jpg; *.bmp; *.gif; *.png') If @error Then Exit If $hFileRead = 1 Then ;---------------------------------> While 1 ;---------------------------------> $Used = FileReadLine($hFileRead) ;---------------------------------> If @error = -1 Then ExitLoop ;---------------------------------> _ArrayDelete($hFilesFolders, $Used) ;---------------------------------> Wend ;---------------------------------> Endif ;---------------------------------> $s_FileList = _ArrayToString($hFilesFolders, "*",1) $a_FileList = StringSplit($s_FileList, "*") $count = $a_FileList[0] $sLine = $a_FileList[1] _ArrayDelete($a_FileList, $sLine) $read = $a_FileList[Random(1, $count, 0)] FileWrite($hFileWrite, $read&@CRLF) ;---------------------------------> SetImage($favDir & $read) Func SetImage($pic) If Not FileExists($pic) Then Return -1 FileDelete($dest) RunWait($exe & ' -out bmp -resize "' & @DesktopWidth & '" "' & @DesktopHeight & '" -o "' & $dest & '" "' & $pic & '"', "", @SW_HIDE) Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop" Local $REG_LOGON= "HKEY_LOCAL_MACHINE\SOFTWARE\Reatogo\Logon\Shells\Explorer" RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 2) RegWrite($REG_DESKTOP, "Wallpaper", "REG_SZ", $pic) RegWrite($REG_LOGON, "Wallpaper", "REG_SZ", $pic) Sleep(250) DllCall("User32.dll", "int", "SystemParametersInfo", _ "int", 20, _ "int", 0, _ "string", $dest, _ "int", 0x01) Return 0 EndFunc The SeenPic.txt looks like this bb19cb8017ba.bmp 5545652ac40f.bmp d991523ed278.bmp ef9e92091cf2.bmp 40cf8d4e2c7b.bmp a14c5a96ba92.bmp bb19cb8017ba.bmp eb01ecd05186.bmp cdefbde86f38.bmp Regards Link to comment Share on other sites More sharing options...
Lapone Posted March 31, 2007 Author Share Posted March 31, 2007 Hi, seems that I figuret out: While 1 $SeenPic = FileReadLine($hFileRead) If @error = -1 Then ExitLoop $Item = _ArraySearch ($hFilesFolders, $SeenPic, 0, 0, 0, True) If Not @error Then _ArrayDelete( $hFilesFolders, $Item) Else EndIf Wend I need a deep reading of Array! Regards Link to comment Share on other sites More sharing options...
gamerman2360 Posted March 31, 2007 Share Posted March 31, 2007 Might want to change Random(1, $count, 0) to Random(1, $count, 1) so it returns and intiger. Otherwise the chance to get the last element in the array will be very slim. Link to comment Share on other sites More sharing options...
Lapone Posted March 31, 2007 Author Share Posted March 31, 2007 Might want to change Random(1, $count, 0) to Random(1, $count, 1) so it returns and intiger. Otherwise the chance to get the last element in the array will be very slim. Yes, you are right. In my folder I have 100 picture. Until the 98 "Seen Picture" no problem whit the last two this error: $read = $a_FileList[Random(1, $count, 1)] $read = ^ ERROR Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded. .... I need some error checking and something to reset the SeenPic.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now