FMPing Posted October 4, 2006 Posted October 4, 2006 (edited) 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 October 4, 2006 by Guest
Wim Decorte Posted October 5, 2006 Posted October 5, 2006 (edited) 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 October 5, 2006 by Guest
FMPing Posted October 5, 2006 Author Posted October 5, 2006 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
Wim Decorte Posted October 5, 2006 Posted October 5, 2006 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
Wim Decorte Posted October 5, 2006 Posted October 5, 2006 should also add that the command line needs the full path to your VBscript: cmd /c c:someFoldersubFoldermyVBScript.vbs
Genx Posted October 5, 2006 Posted October 5, 2006 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).
FMPing Posted October 5, 2006 Author Posted October 5, 2006 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
FMPing Posted October 5, 2006 Author Posted October 5, 2006 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.
Wim Decorte Posted October 6, 2006 Posted October 6, 2006 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
FMPing Posted October 6, 2006 Author Posted October 6, 2006 Thank Wim. What I did wrong was export file rather export field. Thank so much for the help!
Wim Decorte Posted October 6, 2006 Posted October 6, 2006 You're very welcome. Glad you got it fixed.
Recommended Posts
This topic is 6666 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 accountSign in
Already have an account? Sign in here.
Sign In Now