File access error programming in Delphi 7 using ReWrite(f) - delphi-7

Spent 2 hours looking at similar issues and used IsFileInUse, and sure enough it is in use. It loads a jpg image using MapObjectsLt and though I do understand a little of file locking, this software worked perfectly under Windows 7, which we used at work. Now I have moved to Windows 10 on a new laptop, and it only now gives an error. Myself and windows explorer are the only users I am aware of so no one else has that small text file which positions the image when open. I think the difference lies in Windows. I used ProcExp.exe to look at the processes that might be locking/using that file and it could not find that small 6 line file. I changed my code and first unloaded the image before changing the jgw/text file, after which it reloads and is repositioned. If MapObjectsLt locked the file and Windows 7 allowed the change?? Do I change this in code somehow ie force the removal of a handle knowing no one that matters is using the file??
procedure SaveWorldFile(FileName:TFileName);
var f:TextFile; i:Integer; Ext:String[4]; ImageFile:TFileName;
begin
ImageFile:=FileName;
if Pos('.SID',UpperCase(FileName))<>0 then Ext:='.sdw' else
if Pos('.JPG',UpperCase(FileName))<>0 then Ext:='.jgw' else Ext:='.tfw';
FileName:=ChangeFileExt(FileName,Ext);
//tried to close the handle in this function..because
//I believe at this point I am the only one using this file.
//Did not work but was part of my hunt for a solution
//I used for a different reason but found on this site
IsFileInUse(FileName);
//This section worked before and last line reloads the image
//The image is "untouched" only its position changes
//This worked under Windows 7 now Windows 10 does not
AssignFile(f,FileName);
ReWrite(f); //error under Windows 10
for i:=1 to 6 do WriteLn(f,P[i]:0:8);
CloseFile(f);
//Now reload the image
frmWRM.AddImageLayer(ImageFile);
end;

I have found the solution on your site, after hours of following what I thought was a Windows 10 error. It was the permissions on files copied to a hard drive. Once changed my software was working as per normal. Thanks for the hint from your site.

Related

SAP VBS fails to playback recording

I'm automating some reports using visual basic. I've recorded some scripts that worked fine by seem to have stopped working for reasons unknown. I record the following (comments added) and the script fails at a file dialog box.
session.findById("wnd[0]").resizeWorkingPane 95,22,false
session.findById("wnd[0]/tbar[0]/okcd").text = "se16"
session.findById("wnd[0]").sendVKey 0
' Run AGR_TCODES
session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
'Select Extended Name, Multiple selection
session.findById("wnd[0]/usr/btn%_I3_%_APP_%-VALU_PUSH").press
session.findById("wnd[1]").sendVKey 23
' select file
session.findById("wnd[2]/usr/ctxtDY_PATH").text = "c:\my_directory\"
session.findById("wnd[2]/usr/ctxtDY_FILENAME").text = "myfile"
session.findById("wnd[2]").sendVKey 0
Its at this point in script playback that the script just stops with the file select text inputs blank. I can type the information in, but that kinda defeats the purpose. I can't find the reasons or a cause, but lots of various upgrades have occurred, including my laptop and a reinstall of the os to WIN10. I don't really care why - but I do need to find a way around it.
There are 2 scenarios I've identified:
It appears that SAP occasionally loses the focus of dialog boxed. Use gratuitous .setfocus commands on the window to compensate
It appears that uploads via scripts may be blocked by security settings. You can do it manually, but not via script. A telltale sign is that when you record the script, your inputs are not recorded. So the DY_FILENAME.text line will be completely missing from the recording. I'm not sure how to fix this, but at least you know where to look!
Good luck with your scripts.

WatiN downloading files

I am trying to use WatiN to do some screen scraping type of work. It runs on our site on a scheduler. I have no need to see the UI, I just need it to do the work. I can navigate the sites with no issue , but when trying to downlaod the files I have 2 problems.
Using IE 11 when it comes time to download , I get stuck on the open/save dialog that pops up. I have tried and tried and tried everything to have IE 11 auto download files, but to no avail. I edited the registry, and tried every option in the security tab, but no luck. I tried using SendKey.Sendwait("{TAB}"), to mimic what would need to be pressed , but I get "access denied" I think the "ui" is locked.
so I tried Firefox, firefox is easy to configure "automatic downlaods" .... but
FireFox wont even connect, I get: No connection could be made because the target machine actively refused it 127.0.0.1:9997 I installed the appropriate jjsh addon and install it globally for all users from the command line, but still no luck.
Any suggestions on how to disable that yellow bar that IE 11 puts at the bottom of the screen to annoy you , or what I might try with firefox? I believe configuring IE 8 to disable the yellow dialog bar is possible, but I am on a windows 8 machine , so I'm stuck with IE 11, or possibly 10.
You can keep trying to find a solution but that solution will probably break in a next release of IE (based on previous experience) to be able to finally solve and be future proof (if there's such a thing in development....) I would suggest to navigate to the page that has the link and get the HREF portion of it and once you have that link just do the download using other ways, like the following:
(this is just pure C#, not watin)
string downloadURL = "http://example.com/retrievePDF.jsp?id=XXXXX";
client.DownloadFile(downloadURL, #"C:\temp\" + fName + ".pdf");
you should replace the downloadURL with the value on the HREF of your download link and you will be able to find the file where you specify it.

Running AntlrWorks2 stand-alone on Windows 7

I must be missing something. After downloading AntlrWorks2 I found the executable bin/antlrworks2.exe and bin/antlrworks264.exe. Aren't these supposed to be the standalone version of the tool? Neither works for me; after a NetBeans splash screen, the first times around I got an error message on missing packages; after a couple of times I chose to go on regardless, but now (still after the initial spash screen) there is simply nothing happening at all.
I can't find any tutorial or manual detailing how to run AntlrWorks stand-alone, so any help is much appreciated.
This is due to a bug in the NetBeans platform. I filed a report but it hasn't received a reply yet:
Cannot launch platform application after moving installation folder
Here is a workaround that does not delete any preferences you have customized:
I found that deleting just the var folder under the user's generated
.antlrworks2 settings folder resolves the issue...
Still an issue as of date of this post. Deleting the .antlrworks2 folder from \users\username\AppData\Roaming does work - you can find this folder by putting %APPDATA% into your file explorer address bar (exactly as shown) - that will go to the app data folder for your current user login session. Delete the .antlrworks2 folder and then re-run the app.

Adding LESS Extension to Dreamweaver CS5.5

Work gave me a new Macbook Pro yesterday and I'm having a hard time getting Dreamweaver CS5.5 to work with my LESS files. At first, I was getting an error saying that it couldn't open the filetype, so I hit the Adobe help areas and user forums and found the solution about editing Extensions.txt and MMDocumentTypes.xml. So now I can open the files from my local files side panel, but not from File -> Open. And despite having it listed as a Style Sheet extension, code hinting and coloring isn't working. A bizarre twist is that now if I take out my edits to those files, DW still opens the LESS files without an error. Anyone have any ideas how I can get this fully operational?
Here are a couple of the articles I found in my research and followed as best I could:
http://help.adobe.com/en_US/dreamweaver/cs/extend/WS5b3ccc516d4fbf351e63e3d117f53d6108-7fda.html
http://helpx.adobe.com/dreamweaver/kb/change-add-recognized-file-extensions.html
From what I tried today, it kind of makes sense to me now. I have it working on CS5. To get started, you should show all files on your computer. Spotlight (OS X) makes things super easy to find all instances of those files. Once you find it, CMD + R will reveal the parent folder where the file resides.
The "Extensions.txt" handles whether or not DW can open the file from the modal window/program menu. This file is located in 2 places and you should edit using "text edit" or another baside editing program:
USERS/library/Application Support/Adobe/Deamweaver
CS5/en_US/Configuration/Extensions.txt
Applications/Dreamweaver/Configuration/Extensions.txt
To do that you just need to declare a new type:
As part of the "all documents" list you need to add your SCSS,LESS
extensions
As part of the "stylesheets" list you need to add your SCSS,LESS extensions
CSS,SCSS,LESS:Style Sheets
The second file you need to EDIT, is under the folder "DocumentTypes" in CS6 I believe that folder has moved to:
USERS/library/Application Support/Adobe/Deamweaver CS5/en_US/Configuration/
However, in CS5, I found this folder in Applications/Dreamweaver/Configuration/
From here if you edit "MMDocumentTypes.xml" this file it should explain how those extensions you previously defined in "Extensions.txt" should behave. (Again, use a basic text editor).
I think somewhere on line 140 or so, you'll see the following:
<documenttype id="CSS" internaltype="Text" winfileextension="css" macfileextension="css" file="Default.css" writebyteordermark="false" mimetype="text/css" >
From here add "scss,less" to the 'winfileextension' and 'macfileextension'. Because you're on a Mac, you probably want to make sure its filled out in the 'macfileextension' attribute.
The result should look like this:
<documenttype id="CSS" internaltype="Text" winfileextension="css,scss,less" macfileextension="css,scss,less" file="Default.css" writebyteordermark="false" mimetype="text/css" >
Cheers!

Processing, window gets distorted

Just downloaded Processing on a laptop using Windows 7 64bit. This is the very first and basic work that is being done inside of processing itself.
So far, I am trying to re-create the example from the processing tutorial on the site here:
Processing Example.
When doing that simple example my window becomes distorted as soon as I do the following seen in this picture here:
I am completely unsure of why this is happening and sometimes as soon as it does happen, I cannot get it to go away, even after moving the ellipse to another area.
Any ideas?
You have two tabs in there. Unlike in a more traditional IDE, Processing considers all code from all tabs part of the same sketch, so it'll run all the code you have in those tabs. Not just the size/rect/ellipse calls, but also everything in that "test" tab. Fire up a new instance of Processing and just add the size/rect/ellipse calls (or delete the test tab). If it doesn't do weird resizing, problem found.

Resources