Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About fseipel

  • Rank
  • Birthday 11/12/1970

Profile Information

  • Gender
  • Location
    Columbus, Ohio
  1. Yes, you can either set up an event to run on open, every time the Excel file is opened, or have the on open event check for a signal file or registry entry to determine whether to run macro. There is no command line switch to run a macro in MS Excel. Alternately you can launch a VBSCRIPT which can run the macro. See http://stackoverflow.com/questions/2050505/way-to-run-excel-macros-from-command-line-or-batch-file Other Office apps, such as Access, DO allow you to run a macro from command line, but not Excel.
  2. Noël, one other comment on this, you can actually determine where the lines begin & end with iText, by parsing through the tokens. You should find 'l' for line or 're' for rectangle. I would think you could then simply have two arrays, one for the horizontal line positions, and one for the vertical line positions. The FilteredTextRenderListener class which accepts a rectangle parameter, could then be used to parse the text in each 'cell', albeit with a speed penalty of repeated calls. This would have the advantage of being cross-platform, and not requiring Acrobat Pro or the conversion subscription. Also, some of the free tools such as xpdf's pdf2text, include command line switches such as -layout to preserve physical layout upon conversion, typically that preserves somewhat the table structure (text is not perfectly aligned & there will be a variable number of spaces between columns in successive rows), but at least it includes the carriage returns.
  3. Noél, that will run only on Windows. For Mac you'll need to use Applescript. Of course, Acrobat Pro 9.0 or above is still required for this approach. If converted to SM using JACOB COM library, it will still run only on Windows because Macs don't use COM.
  4. qube99: v7 is circa 2005 so that is a rather old version; I think they added export to Excel in ~v9 circa 2008. Current version is 11. I'm still using 10. Hi again Noél, The OLE isn't too bad, the Javascript Guide/Acrobat SDK covers this pretty well, I had to do work with footers/headers a while back. Sorry if original message wasn't very clear about this not being included in Reader (any version). This VB Script will convert a PDF to Excel. I'm assuming one could convert this to Java or Groovy and run directly in ScriptMaster; i.e. build it into a global field or variable, export to a file, and run the VBS that way To convert to SM you'd probably need JACOB for COM communications. Set Acroapp = CreateObject("AcroExch.App") Set PDDoc = CreateObject("AcroExch.PDDoc") result = PDDoc.Open ("C:PDF_INE.pdf") Acroapp.Show Set jso = PDDoc.GetJSObject jso.SaveAs "C:temp.xlsx","com.adobe.acrobat.xlsx" PDDOC.Close AcroApp.CloseAllDocs Acroapp.Hide AcroApp.Exit set Acroapp=Nothing Set PDDOC=Nothing e.g. save as test.vbs in Notepad. Of course FM could execute this directly or using run shell script command.
  5. Yes, you can use SM run shell script with the VOL command or VOL C: as the 'command' argument. Alternately you can write out a batch file from FM, say to temporary folder, e.g. diskpart select disk 0 detail disk exit and then run shell script on that to get the manufacturer and hardware SN The hardware SN is fixed; the VOL SN changes when Windows is re-installed. Note diskpart requires UAC Also if you put diskid32 in a container, you can write it to a temp file & then run it using SM, it returns a wealth of information http://www.winsim.com/diskid32/diskid32.html including HW SN, drive Mfr, etc.
  6. If you 'Save as Excel' (a function available in Acrobat X Pro, which from your message, you have), you will generate a cleanly formatted file you can import into Filemaker that preserves the row/column structure present in the PDF file. If this needs to run on computers with only reader, it still allows conversion, but you have to use Adobe's online service to do so and buy a subscription, i.e. it's not included as it is in Pro Acrobat. You will still need to import into a temporary table since there are several rows before table begins, so script will simply skip until it hits headings row. Automating this process would be possible with Applescript, OLE, etc. If you don't have a huge number to process, simply saving as Excel and importing using an FM script ought to work. This may not be a great solution if there are thousands of files to process. Of course you can also parse the text back into rows/columns.
  7. @john: Thanks for fleshing out the code example. In past I've also used Filemaker's string functions to parse HTML, but the Java libraries seem like a potentially better choice, less likely to break, and more readable/maintainable. I don't see how the OP will be able to tell if an image has changed, short of downloading it and doing a byte comparison against the last downloaded copy, or at least a file byte length comparison (less reliable). If it has to do that over a large number of users/pages, it may be quite slow and a bandwidth hog. If the site(s) offer web services, that may be a much better alternative for data acquisition. I interact a lot with amazon.com, and I always use the web services, except for data which isn't provided by the web services. Screen scraping, in contrast, is slower, and more prone to breaking.
  8. The first parameter should be "renamecontainer::container", in quotes, i.e. the fully qualified container name, rather than renamecontainer::container which is a reference to the container contents..
  9. I'd suggest using an HTML parser such as jsoup, you can then retrieve the image link list easily, e.g. import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; String results = ""; String url = 'http://www.amazon.com'; Document doc = Jsoup.connect(url).get(); Elements media = doc.select("[src]"); for (Element src : media) { if (src.tagName().equals("img")) results = results + src.tagName() + ':' + src.attr("abs:src") + 'n'; } return results;
  10. Tim, It's not a certainty, but the problem is most likely caused by the server being set for key authentication and NOT password authentication. Can you connect to it with Filezilla or other sftp client software? You may need to add key authentication to the code provided. In you client software, are keys set (e.g. in Filezilla, Settings|SFTP|Private keys)?
  11. I had to interface a scale with MS Access yesterday. The main complication was they also wanted the lab scale connected to a titrator, so I used an A/B switch. With Win7, it took some time to find a free keyboard wedge that allowed the 7-E-1 data settings (I had to match Titrator, as it was not configureable on comm settings). If possible, can you simply use a keyboard wedge? If the scale is set up with a PRINT button to print the weight, this works nicely. If scale sends data constantly, with a delimiter, you should be able to read it using standard java libraries, see for example http://www.java-samples.com/showtutorial.php?tutorialid=11 -- rxtx may be better if solution needs to be cross-platform BUT you need to install DLL's and other components for it than just the JAR file. This example should allow you to read weights also: http://www.java-frameworks.com/java/ofbiz/ShipmentScaleApplet.java.html with ScriptMaster. Be sure to include the timeouts on opening port and reading. The biggest problem I've had is COM port numbers sometimes change when USB-->serial adapter moves, ideally Java code ought to loop through COM ports until scale is found.
  12. This is pretty much trivial, at least using the 360Works ScriptMaster plugin. I implemented this a couple months ago, could definitely use clean-up, it simply follows http://forums.ebay.com/db2/topic/File-Exchange/Can-Someone-Please/2000170031 Input variables/parameters, e.g. filename_to_upload = e.g. C:\Users\Frank\Documents\single_item.csv my_token=your token from eBay -- get it here http://pages.ebay.com/sellerinformation/sellingresources/fileexchange_programmaticupload.html ---------------------------------------------------------- /** * This is a sample *fully functional* commandline test program for uploading files * in Sandbox or Production environments. * * the usage for production: * java FEClient prod c:\path\to\file\test.csv token_string_for_prod * * the usage for sandbox: * java FEClient sbx c:\path\to\file\test.csv token_string_for_sandbox * */ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.security.Security; import javax.net.ssl.HttpsURLConnection; String UPLOAD_URL_SANDBOX = "https://bulksell.sandbox.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload"; String UPLOAD_URL_PRODUCTION = "https://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload"; String UPLOAD_URL_QA = "http://bulksell.qa.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload"; String UPLOAD_URL_DEV = "http://localhost:8080/ws/eBayISAPI.dll?FileExchangeUpload"; /** This method reads in a specified file from the system and * returns its contents as a string * @param filename - complete path to file including name * @return String representing file's contents */ protected String readFile(String filename) { StringBuffer data = new StringBuffer(""); try { File file = new File(filename); FileReader fr = new FileReader(file); BufferedReader in2 = new BufferedReader(fr); int c; while ((c = in2.read()) != -1) { data.append((char) c); } } catch (Exception e) { e.printStackTrace(); } return data.toString(); } /** This method uploads the data content passed in to the url passed * and passes the token provided as a form parameter. * @param url - url to post to * @param token - seller's token * @param data - content of file * @return - string status that is parsed from html response */ protected String uploadFile(String url, String token, String data) { /** *String constant for multipart upload form content boundary */ final String CONTENT_BOUNDARY = "-----------------------------BcLtEsToOlBoUnDaRy"; /** *String constant for production environment */ String ENV_PRODUCTION = "prod"; /** *String constant for sandbox environment */ String ENV_SANDBOX = "sbx"; /** *String constant for qa environment */ String ENV_QA = "qa"; /** *String constant for dev environment */ String ENV_DEV = "dev"; // stores response from upload post StringBuffer response = new StringBuffer(""); OutputStream os = null; BufferedReader in2 = null; HttpURLConnection conn = null; try { System.out.println("DEBUG: Connecting to: " + url); URL serverURL = new URL(url); // connect to server URLConnection uc = serverURL.openConnection(); conn = (HttpURLConnection) uc; conn.setAllowUserInteraction(true); //conn.setFollowRedirects(true); conn.setInstanceFollowRedirects(true); // set connection as POST conn.setRequestMethod("POST"); conn.setDoOutput(true); // turns it into a post // setup headers conn.setRequestProperty( "Content-Type", "multipart/form-data; boundary=" + CONTENT_BOUNDARY); conn.setRequestProperty( "User-Agent", "BCLUpload Test Tool/1.0 [en] (Java; U)"); conn.setRequestProperty("Accept-Language", "en-us"); conn.setRequestProperty("Accept-Encoding", "gzip, deflate"); conn.setRequestProperty( "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, application/pdf, application/x-comet, */*"); conn.setRequestProperty("CACHE-CONTROL", "no-cache"); // get reference to stream to post to os = conn.getOutputStream(); // constructing data //System.out.println("DEBUG: file read in was:" + data.toString()); String request = "--" + CONTENT_BOUNDARY + "\r\n" + "Content-Disposition: form-data; name=\"token\"\r\n\r\n"; request = request + token+ "\r\n"+ "--"+ CONTENT_BOUNDARY+ "\r\n"; request = request + "Content-Disposition: form-data; name=\"file\"; filename=\"data.csv\"" + "\r\nContent-Type: text/plain\r\n\r\n"; request = request + data+ "\r\n"+ "--"+ CONTENT_BOUNDARY+ "\r\n"; os.flush(); // performing post os.write(request.getBytes(), 0, request.getBytes().length); os.flush(); // getting reference to response stream in2 = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; // reading respone while ((inputLine = in2.readLine()) != null) { response.append(inputLine); } // closing connections in2.close(); in2 = null; os.close(); os = null; conn.disconnect(); conn = null; } catch (Exception e) { e.printStackTrace(); } finally { if (in2 != null) try { in2.close(); } catch (Exception e) { // ok to ignore this } if (os != null) try { os.close(); } catch (Exception e) { // ok to ignore this } if (conn != null) try { conn.disconnect(); } catch (Exception e) { return e; } } // parse and return response return this.getStatusTextFromResponse(response.toString()); } /** This method parses the message text from the HTML response. * @param response - raw html response * @return String representing message text in HTML response */ protected String getStatusTextFromResponse(String response) { /** *String constant that represents the HTML response's message start */ String RESPONSE_STRING_START = ""; /** *String constant represents the end of the HTML response message end */ String RESPONSE_STRING_END = "."; if (response == null || "".equals(response)) { return response; } String status; // get the index of the start of the message int start = response.toString().indexOf(RESPONSE_STRING_START) + RESPONSE_STRING_START.length(); // get the end of the message location int end = response.toString().indexOf(RESPONSE_STRING_END, start); // set status to substring btw start and end status = response; //status = response.substring(start, end); return status; } /** This method sets up the vars needed for uploading * @param args - args passed to the main program * @return status returned from upload */ protected void downloadFile(String urlToRead, String fileToWrite) { OutputStream os = null; BufferedReader in2 = null; HttpsURLConnection conn = null; try { System.out.println("DEBUG: Connecting to:" + urlToRead); URL serverURL = new URL(urlToRead); conn = (HttpsURLConnection) serverURL.openConnection(); BufferedInputStream is = new BufferedInputStream(conn.getInputStream()); in2 = new BufferedReader(new InputStreamReader(conn.getInputStream())); File file = new File(fileToWrite); os = new FileOutputStream(file); String inputLine; while ((inputLine = in2.readLine()) != null) { os.write(inputLine.getBytes()); } System.out.println("file created:" + fileToWrite); in2.close(); in2 = null; os.close(); os = null; conn.disconnect(); conn = null; } catch (Exception e) { e.printStackTrace(); } finally { if (in2 != null) try { in2.close(); } catch (Exception e) { // ok to ignore this } if (os != null) try { os.close(); } catch (Exception e) { // ok to ignore this } if (conn != null) try { conn.disconnect(); } catch (Exception e) { // ok to ignore this } } } try { // check arg length String status; String env = 'prod'; // For Production Environment //String filepath = 'C:/Users/Frank/Documents/empty2.csv'; String filepath = filename_to_upload; String token = my_token; // // if you are copying & pasting the token by using the API's then the token // will NOT be URL encoded. Uncomment this line if the token was obtained through the FE // web page //token = URLEncoder.encode(token); String uploadURL = null; // set production url uploadURL ="https://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload"; // get data from file involved String data = readFile(filepath); // upload file status = this.uploadFile(uploadURL, token, data); return status; } catch (Exception e) { return e; }
  13. I take it you are converting from .fp7 to FM12 to resolve the problem. The file will open upon conversion. You could include a startup script that checks if the first record in a dummy table is set to say 'close', and if so, unset it and close file, or simply have startup script interrogate the converted file's name to determine whether to close. On successive opens the file will open. You can also perform script in the converted file. Since some commands, such as perform script in second file, don't accept variables (e.g. filename), you may end up needing to rename files prior to running your script & again afterwards, so their name conforms to the fixed name used in the script to close it. If you use 360Works Scriptmaster, you can run a script with variable filename. Another option would be to close the window automatically to close the file. For Windoze, you can achieve that by sending CTRL+F4 key, e.g. run a VBSCRIPT to close the window. See http://www.pctools.com/guides/scripting/detail/149/?act=reference -- similar should be possible with Applescript, kind of a kluge but does work.
  14. Try running a network cable between the robot (client) computer and the switch nearest the server, and/or replacing all cables/switches in that path. Despite all the advice against it, I have never experienced problems running a robot on a server computer. You cannot trap this error within Filemaker. Obviously, addressing the root cause is preferred. Absent that, you can use Applescript to detect the error dialog, send a key to acknowledge it, and re-open the file and run a script, similar to what 'Okey Dokey Pro' used to do in the OS9 era, at least the acknowledge part. So you would activate the application & send a keystroke. I haven't used Applescripts for a couple years, presumably first, you'd test if client was disconnected, I'm assuming Filemaker fails to respond to Apple Events in that case and could be detected that way, otherwise you'd have to search for the window. Alternately, you could just use two files: an opener and the remote client DB. Sending enter acknowledges the dialog; you then delay, and send the key to run macro #1 of the opener, which opens the remote DB and starts the script. Or the Applescript could directly open the remote file & run the macro.
  15. You can name the container field on a layout (layout mode|click on container field, Edit Menu|View|Inspect|Position Tab, input layout name (alias) for container field in Name text input box). You can then have a script loop through the records, using GetLayoutObjectAttribute("Container Alias Name","content"). For (properly) inserted files, content will be the text comprising filename, no path. For OLE objects dragged & dropped, it will be '?'; for records with empty container field, 'content' will be empty. So that will at least identify the offending records. If the record also indicates who input the record or the computer name, you can then narrow the problem down further. Note that if you switch the Winblows clients to FM12, the problem won't be experienced, because OLE support was dropped; hence drag & drop will insert the file, not an OLE link. If clients must run 11, a script trigger, on modify, to check the field's 'content', and disallowing '?'/clearing it/displaying dialog message, might be advised. Once you have identified the records containing OLE links using the looping method above, you should be able to right-click on the container field (at least on the Windoze client). Right clicking will allow you to select 'properties packager shell object'. Under location, will be the path to the file. The file can then be inserted from that path. I don't know of a way to get at that from an automated script, however, because I do not think the FM API exposes the OLE link property.
  • Create New...

Important Information

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