Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

need help on VB script

Featured Replies

Trying to get this script to work in send event in PC, but all it does is open c drive. anyone can help? thx

$filepath is defined as Right ( Get ( DesktopPath ); Length ( Get ( DesktopPath ) )-1) & "PDF Folder/"

"Set objFSO = CreateObject("Scripting.FileSystemObject")" & "¶" &

"If objFSO.FolderExists("" & $filepath & "") Then" & "¶" &

" Set objFolder = objFSO.GetFolder("" & $filepath & "")" & ¶ &

"Else" & "¶" &

"Set objFSO = CreateObject("Scripting.FileSystemObject")" & "¶" &

"Set objFolder = objFSO.CreateFolder("" & $filepath& "")" & "¶" &

"End If"

Edited by Guest

First this:

"Else" & "¶" &

"Set objFSO = CreateObject("Scripting.FileSystemObject")" & "¶" &

You don't need to set objFSO again here, you've already done that earlier in your script.

How do you execute the script? Can you give some more detail about that?

Edited by Guest

  • Author

I export the text to a vbs file and use send event to exec the script.

The script work when I go inside with wordpad and clean up the strange character due to the carriage return that was cause by export the gtext to the vbs file. I try using vbCr and also Chr(13) to replace the return in FM but still no luck.

thx

FM exports line endings as CR, Windows uses CrLf but the Windows script host doesn't care really. I've never had an exported VBscript fail because of it so there must be something else going on.

If there was a VBscript syntax error the WSH engine would throw up an error telling you what line and what error; you're not seeing a error like this are you?

How do you execute the VBscript with the send message? The best way is to calc a full command line and give it:

cmd /c myVBscript.vbs

or even be more explicit and if you're not using any wscript features:

cmd /c cscript.exe myVBscript.vbs

should also add that the command line needs the full path to your VBscript:

cmd /c c:someFoldersubFoldermyVBScript.vbs

Weird, try just exporting the file and executing it manually from wherever it exports to. As wim mentions, swapping the little squares (CR) for an actual return (CRLF) doesn't make any real difference.

Either way, if it executes successfully (after exporting and double-clicking to run it), it's most likely something to do with your filepath (or lack of execution). Most importantly do you get any errors or does it just not operate as expected, or do "nothing"?

On the note of lack of execution, try "open file on export", it's an option when specifying export script step (if it exists in v7).

  • Author

I know is the carriage return is giving the problem after exporting and creating the vbs file, because when windows script exec the script I get 800A0401 error

  • Author

The strange thing is when I open the script with notepad, i see that small rectangular box. If i open with wordpad and go to the first return and back space the first return and reenter the ) the script exec fine.

And I know you're focusing on the wrong thing. The line endings do not matter. They really don't.

Attached is a demo file with your VBscript. Works like a charm. Have a look at it and let me know what you're doing in your script that is different.

FMping_VBS.zip

  • Author

Thank Wim. What I did wrong was export file rather export field. Thank so much for the help!

You're very welcome. Glad you got it fixed.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.