Jump to content
Server Maintenance This Week. ×

need help on VB script


This topic is 6419 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 6419 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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