Note that there are some explanatory texts on larger screens.

plurals
  1. POScript timesout in the middle of execution
    primarykey
    data
    text
    <p>I wrote a small script to help re-organize my .mp3 collection. When I run this script, sometimes it will process several thousand files till it would hit an error condition (normally a move of a file that had a special character in its name/path that I hadn't counted for), but it would often exit the script with the text</p> <blockquote> <p>Script execution time was exceeded on script "C:\DevSpace\mp3move.vbs". Script execution was terminated.</p> </blockquote> <p>Im not sure why this is happening. In an effort to figure out where this occured I added several msgbox lines, and what I found is that a msgbox would popup, but then it would auto-close very quickly.</p> <p>Here is the code - i appoligize for not getting the formatting correctly in the forum </p> <pre><code>'Takes all .MP3 files in the source dir, reads the Artist tag associated with that file 'Checks for a dir named after the artist in the destination dir 'If the folder artist/album does not exists, it will create it 'Then move the .mp3 file to the dest dir Dim oAppShell, oFSO, oFolder, oFolderItems Dim strPath, i Dim sInfo iDebug=0 sInfo = "Item Description" strPath = "K:\_preprocess" sDestination = "K:\Music" Set oAppShell = CreateObject("Shell.Application") Set oFSO = CreateObject("Scripting.FileSystemObject") If not oFSO.FolderExists(strPath) Then WScript.Echo "Folder " &amp; strPath &amp; " is inaccessble" End If Set oFolder = oAppShell.NameSpace(strPath) Set oFolderItems = oFolder.Items() sCreate = "" sExist = "" sMoved = "" If (not oFolderItems is nothing) Then if oFolderItems.Count = 0 then Wscript.echo "no files found in this folder: " &amp; strPath WScript.Quit end If If iDebug = 1 Then i = oFolderItems.count WScript.Echo i End If For Each oItem in oFolderItems If iDebug = 1 Then i = i - 1 End If If oItem.Type = "MP3 audio file (mp3)" or oItem.Type = "MP3 Format Sound (.mp3)"_ Or oItem.Type = "Windows Media Audio file" or oItem.Type = "MP3 Format Sound" then 'get artist name sArtist = oFolder.GetDetailsOf(oItem, 20) If iDebug = 1 Then MsgBox oItem.name MsgBox sArtist End If 'if 'The Beatles' change to 'Beatles, the' If InStr(LCase(sArtist),"the") = 1 Then sArtist = Mid(sArtist,5) &amp; ", the" End If 'remove \ from band name If InStr(sArtist,"\") &gt; 0 Then sArtist = Replace(sAlbum,"\","") End If If InStr(sArtist,"/") &gt; 0 Then sArtist = Replace(sAlbum,"/","") End If If iDebug = 1 Then MsgBox sArtist End If 'if folder does not exist create 'MsgBox sDestination &amp; "\" &amp; sArtist If oFSO.FolderExists(sDestination &amp; "\" &amp; sArtist) Then 'MsgBox "EXIST" sExist = sExist &amp; sDestination &amp; "\" &amp; sArtist &amp; " exists" &amp; vbCrLf Else 'MsgBox "CREATE " &amp; sDestination &amp; "\" &amp; sArtist rtn = oFSO.CreateFolder(sDestination &amp; "\" &amp; sArtist) sCreate = sCreate &amp; sDestination &amp; "\" &amp; sArtist &amp; " created" &amp; vbCrLf End If 'get album name sAlbum = oFolder.GetDetailsOf(oItem, 14) 'remove special characters from album name If InStr(sAlbum,":") &gt; 0 Then sAlbum = Replace(sAlbum,":","") End if If InStr(sAlbum,"?") &gt; 0 Then sAlbum = Replace(sAlbum,"?","") End If If InStr(sAlbum,"...") &gt; 0 Then sAlbum = Replace(sAlbum,"...","") End If If InStr(sAlbum,"/") &gt; 0 Then sAlbum = Replace(sAlbum,"/","") End If If InStr(sAlbum,"\") &gt; 0 Then sAlbum = Replace(sAlbum,"\","") End If 'create dir artist/album If oFSO.FolderExists (sDestination &amp; "\" &amp; sArtist &amp; "\" &amp; sAlbum) Then 'sExist = sExist &amp; sDestination &amp; "\" &amp; sArtist &amp; sAlbum &amp; " exists" &amp; vbCrLf Else 'MsgBox sDestination &amp; "\" &amp; sArtist &amp; "\" &amp; sAlbum rtn = oFSO.CreateFolder (sDestination &amp; "\" &amp; sArtist &amp; "\" &amp; sAlbum) 'sCreate = sCreate &amp; sDestination &amp; "\" &amp; sArtist &amp; " created" &amp; vbCrLf End If 'move file sSource = strPath &amp; "\" &amp; oItem.name &amp; ".mp3" sDest = sDestination &amp; "\" &amp; sArtist &amp; "\" &amp; sAlbum &amp; "\" If iDebug=1 Then MsgBox sSource &amp; vbCrLf &amp; sDest End If If oFSO.FileExists (sSource) Then oFSO.MoveFile sSource, sDest 'sMoved = sMoved &amp; sSource &amp; " moved to " &amp; sDest &amp; vbcrlf 'MsgBox smoved Else MsgBox sSource &amp; " not moved" End If End If If iDebug = 1 WScript.Sleep 1000 WScript.Echo i End If Next If iDebug=1 WScript.Echo i End if 'MsgBox sCreate 'MsgBox sExist 'MsgBox sMoved End If </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload