Recommended Posts

Here ya go. For these to work, you'll need to have XP or download the latest version of Windows Scripting Host from Microsoft - think it's v5.6.

'NewFolder.vbs

Option Explicit
Dim fso, ws, objArgs, Title
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject("Wscript.Shell")
Set objArgs = WScript.Arguments
Title = "Create New Folder"

Call MakeNewFolder

Call Cleanup

Sub MakeNewFolder
Dim strArg, FolderTemp, FolderPath, NewFldr
For Each strArg in objArgs
FolderTemp = FolderTemp & " " & strArg
Next
FolderPath = Trim(FolderTemp)
NewFldr = InputBox("Name for New Folder?", Title, "New Folder")
If NewFldr = "" Then Call Cleanup
On Error Resume Next
fso.CreateFolder FolderPath & NewFldr
If Err.Number = 58 Then
Err.Clear:On Error GoTo 0
ws.Popup Chr(34) & NewFldr & Chr(34) & " already exists.", ,Title, 0 + 48 + 4096
Call MakeNewFolder
ElseIf Err.Number = 52 Then
Err.Clear:On Error GoTo 0
ws.Popup Chr(34) & NewFldr & Chr(34) & " contains invalid character(s).", ,Title, 0 + 48 + 4096
Call MakeNewFolder
End If
End Sub

Sub Cleanup
Set ws = Nothing
Set fso = Nothing
WScript.Quit
End Sub  

'NewTextDoc.vbs

Option Explicit
Dim fso, ws, objArgs, Title 
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject("Wscript.Shell")
Set objArgs = WScript.Arguments
Title = "Create New Text Document"

Call MakeNewDoc

Call Cleanup

Sub MakeNewDoc
Dim strArg, FolderTemp, FolderPath, NewDoc
For Each strArg in objArgs
FolderTemp = FolderTemp & " " & strArg
Next
FolderPath = Trim(FolderTemp)
NewDoc = InputBox("Name for New Document?", Title, "New Text Document")  
If NewDoc = "" Then Call Cleanup
On Error Resume Next
fso.CreateTextFile FolderPath & NewDoc & ".txt", False
If Err.Number = 58 Then
Err.Clear:On Error GoTo 0
ws.Popup Chr(34) & NewDoc & Chr(34) & " already exists.", ,Title, 0 + 48 + 4096
Call MakeNewDoc
ElseIf Err.Number = 52 Then
Err.Clear:On Error GoTo 0
ws.Popup Chr(34) & NewDoc & Chr(34) & " contains invalid character(s).", ,Title, 0 + 48 + 4096
Call MakeNewDoc
End If
End Sub

Sub Cleanup
Set ws = Nothing
Set fso = Nothing
WScript.Quit
End Sub  

Is there anyway to make it act like the default New Folder/New Text Document menu items do? By that, I mean just have 'em make the folder/file with a default name, and not pop up a dialog like it currently does. I've played with the vbs source a bit, but so far everything I do breaks the script. :D

Edit: Alright, I got it to make a directory/text file without asking for a name, but if it already exists the script goes into an infinite loop. Is it possible to do something like..

if 'NewFoldr' exists

NewFoldr = "New Folder (2)"

Same thing with the New Text Document script.

Edited by RaGe-

RaGe- Something like this you mean?

'NewFolder.vbs
'Version 1.1 for RaGe-

Option Explicit
Dim fso, ws, objArgs, Count
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject("Wscript.Shell")
Set objArgs = WScript.Arguments
Count = 0

Call MakeNewFolder

Call Cleanup

Sub MakeNewFolder
Dim strArg, FolderTemp, FolderPath, NewFldr
For Each strArg in objArgs
FolderTemp = FolderTemp & " " & strArg
Next
FolderPath = Trim(FolderTemp)
If Count = 0 Then
NewFldr = "New Folder"
Else
NewFldr = "New Folder (" & Count & ")"
End If
On Error Resume Next
fso.CreateFolder FolderPath & NewFldr
If Err.Number = 58 Then
Err.Clear:On Error GoTo 0
Count = Count + 1
Call MakeNewFolder
End If
End Sub

Sub Cleanup
Set ws = Nothing
Set fso = Nothing
WScript.Quit
End Sub ?

'NewTextDoc.vbs
'Version 1.1 for RaGe-

Option Explicit
Dim fso, ws, objArgs, Count 
Set fso = CreateObject("Scripting.FileSystemObject")
Set ws = CreateObject("Wscript.Shell")
Set objArgs = WScript.Arguments
Count = 0

Call MakeNewDoc

Call Cleanup

Sub MakeNewDoc
Dim strArg, FolderTemp, FolderPath, NewDoc
For Each strArg in objArgs
FolderTemp = FolderTemp & " " & strArg
Next
FolderPath = Trim(FolderTemp)
If Count = 0 Then
NewDoc = "New Text Document" 
Else
NewDoc = "New Text Document (" ?& Count & ")"
End If
On Error Resume Next
fso.CreateTextFile FolderPath & NewDoc & ".txt", False
If Err.Number = 58 Then
Err.Clear:On Error GoTo 0
Count = Count + 1
Call MakeNewDoc
End If
End Sub

Sub Cleanup
Set ws = Nothing
Set fso = Nothing
WScript.Quit
End Sub ?

BTW, please note that I'm not exactly a vbscript guru. It took me about a month to get these scripts working in the first place so no really difficult questions pleas:D :D

Did it anyway :D

'Begin code for FileExtXP.vbs
'Version: 1.0 - Windows XP (October 9, 2003)

Option Explicit
Dim WSHShell, RegKey, FileExt
Set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\"
FileExt = WSHShell.RegRead (RegKey & "HideFileExt")

If FileExt = 1 Then ? 'File extensions hidden
 ? ? ?WSHShell.RegWrite RegKey & "HideFileExt", 0, "REG_DWORD" ? 'Show file extensions
Else
 ? ? ?WSHShell.RegWrite RegKey & "HideFileExt", 1, "REG_DWORD" ? 'Hide file extensions
End If

WSHShell.SendKeys "+{F10}e" ? 'Refresh

Actually, I have a bit of a question...

Neither the New Text Doc nor the New Folder scripts work. I can double-click them in the folder I hold them in and they do what they're supposed to, but when I use the context menu they don't work... Any suggestions?

First of all, I have to say, THANK YOU!!! These vbs scripts are awesome and very useful, especially the show file extensions and show/hide folders.. I've seen the New Folder option in other tweak progs. Just one thing, however. I can't seem to get the New folder vbs to work. Well, actually, it does work but it creates the new folder in Documents and Settings\Gabe Flores directory instead of the directory i'm currently in. Any suggestions? Thanks again!

ps: do you know of a way to remove a bunch of junk from the context menu, such as "move to folder" and "customize this folder" and the Windows Media Player context menu, among other things? Thanks.

Edited by gflores
do you know of a way to remove a bunch of junk from the context menu, such as "move to folder"  and "customize this folder" and the Windows Media Player context menu, among other things? Thanks.

Download a program called X-Setup. This will let you remove a bunch of stuff from your context menus.

As far as I can remember, to remove the WMP context menu options you have to unregister a dll. Try typing

regsvr32 /u wmpshell.dll

in the run box.

If you need any more help just let me know :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • I disagree here sorry. The majority of their customers are corporations who are locked in to their eco system and have no choice. Private individuals don't contribute that much to their income.
    • Weekend PC Game Deals: Anno 117, Final Fantasy VII, Rematch, and more by Pulasthi Ariyasinghe Weekend PC Game Deals is where the hottest gaming deals from all over the internet are gathered into one place every week for your consumption. So kick back, relax, and hold on to your wallets. The Epic Games Store's mystery giveaways may have ended, but its regular freebies didn't miss a step this week. The double drop was for copies of Warhammer 40K Speed Freeks and The Ouroboros King. Speed Freeks lands for multiplayer racing fans, but with plenty of competitive shooting elements too. You will be piloting Ork buggies, tanks, and aircraft modeled after the popular tabletop miniatures while trying to complete objectives and pass finish lines. Next, Ouroboros King is a crossover between chess and tactical roguelikes, offering the chance to create your own army with special rules to beat incoming foes on the board. The double giveaway on the Epic Games Store will be available until June 11, and replacing it will be Citizen Sleeper and ROBOBEAT. The Humble Store brought a new charity bundle to check out this week too. Landing with the name The Complete Inkle Library, this is a large collection of interactive narrative puzzle games from the publisher Inkle. This begins with Heaven's Vault, four parts from the Sorcery series, 80 Days, Overboard, and Pendragon: Narrative Tactics within the starting tier for $9. Hopping up a step to the $12 tier gets you TR-49, Expelled, and A Highland Song for paying at least $12. If you go for the $20 tier, you get four e-books from the Heaven's Vault series. The bundle has almost three weeks on its counter before it goes away. Big Deals There is a larger than normal amount of weekend specials happening this time, including multiple publisher deals, franchise discounts, and indie gems to grab. With those and more, here's our hand-picked big deals list for the weekend: Anno 117: Pax Romana – $44.99 on Steam Clair Obscur: Expedition 33 – $39.99 on Steam Timberborn – $27.99 on Steam EARTH DEFENSE FORCE 6 – $26.39 on Steam Rust – $19.99 on Steam FINAL FANTASY VII REBIRTH – $19.99 on Steam Street Fighter 6 – $19.99 on Steam Returnal – $19.79 on Steam Shape of Dreams – $17.49 on Steam Far Cry 6 – $14.99 on Steam Assassin's Creed Valhalla – $14.99 on Steam Quarantine Zone: The Last Check – $14.99 on Steam REMATCH – $14.99 on Steam EA SPORTS FC 26 – $13.99 on Steam FINAL FANTASY VII REMAKE INTERGRADE – $13.99 on Steam Magicraft – $12.79 on Steam Cult of the Lamb – $12.49 on Steam Dying Light 2: Reloaded Edition – $11.99 on Steam Cuphead – $11.99 on Steam Assassin's Creed Odyssey – $11.99 on Steam Hunt: Showdown 1896 – $11.99 on Steam Sektori – $11.99 on Steam Just Shapes & Beats – $11.99 on Steam Gunfire Reborn – $10.99 on Steam 33 Immortals – $9.99 on Epic Store Baby Steps – $9.99 on Steam Sifu – $9.99 on Steam Hearts of Iron IV – $9.99 on Steam DREDGE – $9.99 on Steam DAVE THE DIVER – $9.99 on Steam Pacific Drive – $9.89 on Steam Mycopunk – $9.74 on Steam Sons Of The Forest – $8.99 on Steam Jotunnslayer: Hordes of Hel – $8.99 on Steam Nuclear Throne – $8.99 on Steam Mechabellum – $8.99 on Steam Deep Rock Galactic: Survivor – $8.44 on Steam TerraTech Legion – $7.99 on Steam Inscryption – $7.99 on Steam Assassin's Creed Unity – $7.49 on Steam Minishoot' Adventures – $7.49 on Steam The Stanley Parable – $7.49 on Steam Oxygen Not Included – $7.49 on Steam Megabonk – $6.99 on Steam Look Outside – $5.99 on Steam Vampire Hunters – $5.24 on Steam MOTHERGUNSHIP – $4.99 on Steam My Friend Pedro – $3.99 on Steam The Messenger – $3.99 on Steam Vampire Survivors – $3.74 on Steam Brotato – $2.99 on Steam Enter the Gungeon – $2.99 on Steam Loop Hero – $2.99 on Steam GRIS – $2.99 on Steam Exit the Gungeon – $2.49 on Steam Hitman: Absolution – $1.99 on Steam CARRION – $1.99 on Steam Don't Starve Together – $1.49 on Steam Golf With Your Friends – $1.49 on Steam Hotline Miami – $0.99 on Steam The Ouroboros King – $0 on Epic Store Warhammer 40K Speed Freeks – $0 on Epic Store DRM-free Specials Hopping over to the DRM-free deals, the GOG store has plenty of discounts running this weekend too. Here are some highlights: Fallout 4: Game of the Year Edition - $15.99 on GOG Fallout: New Vegas Ultimate Edition - $9.99 on GOG Disco Elysium - The Final Cut - $9.99 on GOG Crysis - $9.99 on GOG Tyranny - Standard Edition - $7.49 on GOG Frostpunk: Game of the Year Edition - $7.35 on GOG Banished - $6.79 on GOG Fallout 3: Game of the Year Edition - $6.59 on GOG The Forgotten City - $6.25 on GOG The Age of Decadence - $5.99 on GOG SimCity 3000 Unlimited - $4.99 on GOG Assassin's Creed: Director's Cut - $4.99 on GOG SimCity 4 Deluxe Edition - $3.99 on GOG Vampyr - $3.99 on GOG Torchlight II - $3.99 on GOG Deus Ex GOTY Edition - $3.49 on GOG Primordia - $3.09 on GOG Theme Hospital - $2.99 on GOG SimCity 2000 Special Edition - $2.99 on GOG Total Annihilation: Kingdoms + Iron Plague - $2.99 on GOG Deus Ex: Human Revolution - Director’s Cut - $2.99 on GOG Master of Orion 1+2 - $2.39 on GOG Prince of Persia: The Sands of Time - $1.99 on GOG Prince of Persia: Warrior Within - $1.99 on GOG EVERSPACE - $1.99 on GOG Total Annihilation: Commander Pack - $0.99 on GOG Keep in mind that availability and pricing for some deals could vary depending on the region. That's it for our pick of this weekend's PC game deals, and hopefully, some of you have enough self-restraint not to keep adding to your ever-growing backlogs. As always, there are an enormous number of other deals ready and waiting all over the interwebs, as well as on services you may already subscribe to if you comb through them, so keep your eyes open for those, and have a great weekend.
    • When will the Photos app be updated to remember the window size and position when reopened? They addressed this issue in a 2024 version of the app (though I can't recall the build number). Unfortunately, after that specific version, the problem persists! Please prioritise this fix in your K2 schedule. Additionally, the Snipping Tool has lost the ability to capture the Windows Taskbar starting from the 2024 version!
    • Same, never saw it on Android or iOS. Guess only some people got it *shrugs*
  • Recent Achievements

    • Week One Done
      ssd21345 earned a badge
      Week One Done
    • Contributor
      MarkHughes4096 went up a rank
      Contributor
    • Dedicated
      jordanspringer earned a badge
      Dedicated
    • Rookie
      Rimplesnort went up a rank
      Rookie
    • One Year In
      Markus94287 earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      486
    2. 2
      +Edouard
      173
    3. 3
      PsYcHoKiLLa
      139
    4. 4
      ATLien_0
      94
    5. 5
      Steven P.
      79
  • Tell a friend

    Love Neowin? Tell a friend!